コード例 #1
0
def f_blockOnScheduledJobs(**kwargs):
    '''
    A simple wrapper around a stage.kwBlockOnSchedule(...)
    call.
    '''
    str_blockUntil      = "0"
    str_blockProcess    = ""
    timepoll            = 10
    for key, val in kwargs.iteritems():
        if key == 'obj':                stage                   = val
        if key == 'blockCondition':     str_blockCondition      = val
        if key == 'blockProcess':       str_blockProcess        = val
        if key == 'blockUntil':         str_blockUntil          = val
        if key == 'timepoll':           timepoll                = val
    str_blockMsg    = '''\n
    Postconditions are still running: multiple '%s' instances
    detected in cluster %s (%s). Blocking until all scheduled jobs are
    completed. Block interval = %s seconds.
    \n''' % (str_blockProcess,
             stage.shell().clusterName(),
             stage.shell().clusterType(),
             timepoll)
    str_loopMsg     = 'Waiting for scheduled jobs to complete... ' +\
                      '(hit <ctrl>-c to kill this script).    '
    stage.kwBlockOnScheduler(   loopMsg         = str_loopMsg,
                                blockMsg        = str_blockMsg,
                                blockUntil      = str_blockUntil,
                                blockProcess    = str_blockProcess,
                                timeout         = timepoll)
    return True
コード例 #2
0
    def f_stage0callback(**kwargs):
        for key, val in kwargs.iteritems():
            if key == 'jobs':   jobs            = val
            if key == 'obj':    stage           = val
            if key == 'pipe':   pipeline        = val

        # Create shell for scheduling/executing on the remote HPC
        pipeline.stageShell_createRemoteInstance(args.cluster, stage=stage)
            
        for job in range(0, int(args.jobs)):
            log = stage.log()
            log('Processing job: %d...\n' % job)
            str_cmd = args.cmd
            shell = stage.shell()
            shell.echo(True)
            shell(
                str_cmd, waitForChild=shell.waitForChild(), 
                stdoutflush=True, stderrflush=True
            )
            if shell.exitCode():
                error.fatal(hpc, 'stageExec', shell.stderr())
        os.chdir(pipeline.startDir())
        return True
コード例 #3
0
 def stageShell_createRemoteInstance(self, astr_remoteHPC, **kwargs):
     '''
     Returns a crun object in the passed stage object that
     functions as a shell on the remote HPC.
     '''
     for key, val in kwargs.iteritems():
         if key == 'stage':          stage   = val
     for case in misc.switch(astr_remoteHPC):
         if case('PICES'):
             stage.shell(crun.crun_hpc_mosix(
                     remoteUser="******",
                     remoteHost="rc-majesty.tch.harvard.edu")
                     )
             stage.shell().emailUser('*****@*****.**')
             b_jobDetach         = True
             b_disassocaite      = True
             b_waitForChild      = False
             break
         if case('launchpad'):
             stage.shell(crun.crun_hpc_launchpad(
                     remoteUser="******",
                     remoteHost="fnndsc:7774")
                     )
             b_jobDetach         = False
             b_disassocaite      = False
             b_waitForChild      = True
             break
         if case('erisone'):
             stage.shell(crun.crun_hpc_lsf(
                     remoteUser="******",
                     remoteHost="fnndsc:7773")
                     )
             stage.shell().scheduleHostOnly(
             "cmu058 cmu059 cmu061 cmu066 cmu067 cmu071 cmu073 cmu075 cmu077 cmu079 cmu081 cmu087 cmu090 cmu093 cmu094 cmu095 cmu096 cmu102 cmu106 cmu107 cmu108 cmu109 cmu111 cmu112 cmu114 cmu121 cmu123 cmu126 cmu149 cmu154 cmu156 cmu157 "
             )
             b_jobDetach         = False
             b_disassocaite      = False
             b_waitForChild      = True
             break
         if case():
             error.fatal(self, 'noClusterSpec')
     shell = stage.shell()
     shell.emailWhenDone(True)
     if args.b_debug:
         shell.echo(True)
         shell.echoStdOut(True)
     else:
         shell.echo(False)
         shell.echoStdOut(False)
     shell.detach(b_jobDetach)
     shell.disassociate(b_disassocaite)
     shell.waitForChild(b_waitForChild)