Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

setupWorkspace.py 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import os
  2. import shutil
  3. import sys
  4. homeFolder = os.path.expanduser('~')
  5. thisFilePath = os.path.split(os.path.abspath(__file__))[0]
  6. try:
  7. import regmaxsn
  8. utilsDir = os.path.join(os.path.abspath(regmaxsn.__path__[0]), 'scripts', 'utils')
  9. except ImportError as e:
  10. raise(ImportError('The package regmaxsn must be installed before this script can be used.'))
  11. whereToCreate = raw_input("Enter where the workspace must be created (using {} "
  12. "if nothing is specifed):".format(homeFolder))
  13. if whereToCreate == "":
  14. whereToCreate = homeFolder
  15. assert os.path.exists(whereToCreate), "Specified path {} does not exist".format(whereToCreate)
  16. pkgParFilesDir = os.path.join(thisFilePath, "ParFiles")
  17. pkgTestFilesDir = os.path.join(thisFilePath, "TestFiles")
  18. assert os.path.isdir(pkgParFilesDir) and os.path.isdir(pkgTestFilesDir), "Folders 'ParFiles' and 'TestFiles' that " \
  19. "came along with this script were not found!" \
  20. "Aborting!"
  21. workSpace = os.path.join(whereToCreate, 'RegMaxSN_WorkSpace')
  22. try:
  23. if os.path.exists(workSpace):
  24. ch = raw_input('A RegMaxSN Workspace already exists. Delete it and all files in it and create new one?(y/n):')
  25. if ch == "y":
  26. shutil.rmtree(workSpace)
  27. else:
  28. sys.exit('User Abort')
  29. os.mkdir(workSpace)
  30. except IOError as e:
  31. raise(IOError('Error writing into {}. Please make sure its writable'.format(workSpace)))
  32. parFilesDir = os.path.join(workSpace, "ParFiles")
  33. shutil.copytree(pkgParFilesDir, parFilesDir)
  34. testFilesDir = os.path.join(workSpace, "TestFiles")
  35. shutil.copytree(pkgTestFilesDir, testFilesDir)
  36. utilScriptsDir = os.path.join(workSpace, "utilityScripts")
  37. shutil.copytree(utilsDir, utilScriptsDir)
  38. resDir = os.path.join(workSpace, "Results")
  39. os.mkdir(resDir)
  40. os.mkdir(os.path.join(resDir, "Tests"))
  41. os.mkdir(os.path.join(resDir, "Reg-MaxS"))
  42. os.mkdir(os.path.join(resDir, "Reg-MaxS-N"))
  43. os.mkdir(os.path.join(resDir, "PCABased"))
  44. print("Succesfullly created Work Space at {}".format(workSpace))