Beispiel #1
0
if n <>2:
    usage("This script accepts 1 parameter: the project name.")

projName = sys.argv[1]

path = os.path.join(os.environ['SCIPION_HOME'], 'pyworkflow', 'gui', 'no-tkinter')
sys.path.insert(1, path)

# Create a new project
manager = Manager()

if not manager.hasProject(projName):
    usage("There is no project with this name: %s"
          % pwutils.red(projName))

# the project may be a soft link which may be unavailable to the cluster so get the real path
try:
    projectPath = os.readlink(manager.getProjectPath(projName))
except:
    projectPath = manager.getProjectPath(projName)

project = Project(projectPath)
project.load()

runs = project.getRuns()

# Now assuming that there is no dependencies between runs
# and the graph is lineal
for prot in runs:
    project.scheduleProtocol(prot)
manager = Manager()

if not manager.hasProject(projName):
    usage("There is no project with this name: %s"
          % pwutils.red(projName))

# the project may be a soft link which may be unavailable to the cluster so get the real path
try:
    projectPath = os.readlink(manager.getProjectPath(projName))
except:
    projectPath = manager.getProjectPath(projName)

project = Project(pw.Config.getDomain(), projectPath)
project.load()

runs = project.getRuns()

# Now assuming that there is no dependencies between runs
# and the graph is lineal
for prot in runs:
    protClassName = prot.getClassName()
    protLabelName = prot.getObjLabel()
    if (protClassName not in sys.argv[3:] and
            protLabelName not in sys.argv[3:]):
        project.scheduleProtocol(prot)
        # Wait 1 seconds to avoid concurrent activity
        time.sleep(0.7)
    else:
        print(pwutils.blueStr("\nNot scheduling '%s' protocol named '%s'.\n"
                              % (protClassName, protLabelName)))
# the project may be a soft link which may be unavailable to the cluster
# so get the real path

try:
    projectPath = os.readlink(manager.getProjectPath(projName))
except:
    projectPath = manager.getProjectPath(projName)

project = Project(pw.Config.getDomain(), projectPath)
project.load()

runGraph = project.getRunsGraph()
roots = runGraph.getRootNodes()

# Now assuming that there is no dependencies between runs
# and the graph is lineal

for root in roots:
    for child in root.getChilds():
        workflow, _ = project._getWorkflowFromProtocol(child.run)
        for prot, level in workflow.values():
            protClassName = prot.getClassName()
            protLabelName = prot.getObjLabel()
            if (protClassName not in sys.argv[3:] and
                    protLabelName not in sys.argv[3:]):
                project.scheduleProtocol(prot,
                                         initialSleepTime=level*INITIAL_SLEEP_TIME)
            else:
                print(pwutils.blueStr("\nNot scheduling '%s' protocol named '%s'.\n"
                                      % (protClassName, protLabelName)))