コード例 #1
0
def main():
    """Restarts a toil workflow.
    """

    ##########################################
    #Construct the arguments.
    ##########################################

    parser = OptionParser()
    addOptions(parser)

    options, args = parser.parse_args()

    if len(args) != 0:
        parser.error("Unrecognised input arguments: %s" % " ".join(args))

    if len(sys.argv) == 1:
        parser.print_help()
        sys.exit(0)

    assert len(args) <= 1  #Only toil may be specified as argument
    if len(args) == 1:  #Allow toil directory as arg
        options.jobStore = args[0]

    ##########################################
    #Now run the toil construction/leader
    ##########################################

    setLoggingFromOptions(options)
    options.restart = True
    with setupToil(options) as (config, batchSystem, jobStore):
        jobStore.clean()
        mainLoop(config, batchSystem, jobStore, Job._loadRootJob(jobStore))
コード例 #2
0
ファイル: toilRestart.py プロジェクト: kellrott/toil
def main():
    """Restarts a toil workflow.
    """
    
    ##########################################
    #Construct the arguments.
    ##########################################  

    parser = getBasicOptionParser()

    parser.add_argument("--version", action='version', version=version)

    parser.add_argument("jobStore", type=str,
          help=("Store in which to place job management files \
          and the global accessed temporary files"
          "(If this is a file path this needs to be globally accessible "
          "by all machines running jobs).\n"
          "If the store already exists and restart is false an"
          " ExistingJobStoreException exception will be thrown."))

    options = parseBasicOptions(parser)
        
    ##########################################
    #Now run the toil construction/leader
    ##########################################  
        
    setLoggingFromOptions(options)
    options.restart = True
    with setupToil(options) as (config, batchSystem, jobStore):
        jobStore.clean(Job._loadRootJob(jobStore))
        mainLoop(config, batchSystem, jobStore, Job._loadRootJob(jobStore))
コード例 #3
0
ファイル: toilRestart.py プロジェクト: benedictpaten/toil
def main():
    """Restarts a toil workflow.
    """
    
    ##########################################
    #Construct the arguments.
    ##########################################  
    
    parser = OptionParser()
    addOptions(parser)
    
    options, args = parser.parse_args()
    
    if len(args) != 0:
        parser.error("Unrecognised input arguments: %s" % " ".join(args))
        
    if len(sys.argv) == 1:
        parser.print_help()
        sys.exit(0)
    
    assert len(args) <= 1 #Only toil may be specified as argument
    if len(args) == 1: #Allow toil directory as arg
        options.jobStore = args[0]
        
    ##########################################
    #Now run the toil construction/leader
    ##########################################  
        
    setLoggingFromOptions(options)
    options.restart = True
    with setupToil(options) as (config, batchSystem, jobStore):
        jobStore.clean()
        mainLoop(config, batchSystem, jobStore, Job._loadRootJob(jobStore))
コード例 #4
0
def main():
    """Restarts a toil.
    """
    
    ##########################################
    #Construct the arguments.
    ##########################################  
    
    parser = OptionParser()
    addOptions(parser)
    
    options, args = parser.parse_args()
    
    if len(args) != 0:
        parser.error("Unrecognised input arguments: %s" % " ".join(args))
        
    if len(sys.argv) == 1:
        parser.print_help()
        sys.exit(0)
    
    assert len(args) <= 1 #Only toil may be specified as argument
    if len(args) == 1: #Allow toil directory as arg
        options.toil = args[0]
        
    ##########################################
    #Now run the toil construction/leader
    ##########################################  
        
    setLoggingFromOptions(options)
    with setupToil(options) as (config, batchSystem, jobStore):
        jobStore.clean()
        if "rootJob" not in config.attrib:
            print "There is no root batchjob in the toil from which to start, exiting"
            sys.exit(0)
        return mainLoop(config, batchSystem, jobStore, jobStore.load(config.attrib["rootJob"]))
コード例 #5
0
ファイル: toilRestart.py プロジェクト: arkal/toil
def main():
    """Restarts a toil workflow.
    """

    ##########################################
    #Construct the arguments.
    ##########################################

    parser = getBasicOptionParser()

    parser.add_argument("--version", action='version', version=version)

    parser.add_argument(
        "jobStore",
        type=str,
        help=("Store in which to place job management files \
          and the global accessed temporary files"
              "(If this is a file path this needs to be globally accessible "
              "by all machines running jobs).\n"
              "If the store already exists and restart is false an"
              " ExistingJobStoreException exception will be thrown."))

    options = parseBasicOptions(parser)

    ##########################################
    #Now run the toil construction/leader
    ##########################################

    setLoggingFromOptions(options)
    options.restart = True
    with setupToil(options) as (config, batchSystem, jobStore):
        # Load the whole jobstore into memory in a batch
        logger.info("Downloading entire JobStore")
        jobCache = {
            jobWrapper.jobStoreID: jobWrapper
            for jobWrapper in jobStore.jobs()
        }
        logger.info("{} jobs downloaded.".format(len(jobCache)))
        jobStore.clean(Job._loadRootJob(jobStore), jobCache=jobCache)
        mainLoop(config,
                 batchSystem,
                 jobStore,
                 Job._loadRootJob(jobStore),
                 jobCache=jobCache)
コード例 #6
0
ファイル: common.py プロジェクト: awesome-python/toil
 def _runMainLoop(self, rootJob):
     """
     Runs the main loop with the given job.
     :param toil.job.Job rootJob: The root job for the workflow.
     :rtype: Any
     """
     with RealtimeLogger(self._batchSystem, level=self.options.logLevel if self.options.realTimeLogging else None):
         # FIXME: common should not import from leader
         from toil.leader import mainLoop
         return mainLoop(config=self.config,
                         batchSystem=self._batchSystem,
                         provisioner=None,
                         jobStore=self._jobStore,
                         rootJobWrapper=rootJob,
                         jobCache=self._jobCache)
コード例 #7
0
ファイル: toilRestart.py プロジェクト: joshuabhk/toil
def main():
    """Restarts a toil workflow.
    """
    
    ##########################################
    #Construct the arguments.
    ##########################################  

    parser = getBasicOptionParser()

    parser.add_argument("--version", action='version', version=version)

    parser.add_argument("jobStore", type=str,
          help=("Store in which to place job management files \
          and the global accessed temporary files"
          "(If this is a file path this needs to be globally accessible "
          "by all machines running jobs).\n"
          "If the store already exists and restart is false an"
          " ExistingJobStoreException exception will be thrown."))

    options = parseBasicOptions(parser)
        
    ##########################################
    #Now run the toil construction/leader
    ##########################################  
        
    setLoggingFromOptions(options)
    options.restart = True
    with setupToil(options) as (config, batchSystem, jobStore):
        # Load the whole jobstore into memory in a batch
        logger.info("Downloading entire JobStore")
        jobCache = {jobWrapper.jobStoreID: jobWrapper
            for jobWrapper in jobStore.jobs()}
        logger.info("{} jobs downloaded.".format(len(jobCache)))
        jobStore.clean(Job._loadRootJob(jobStore), jobCache=jobCache)
        mainLoop(config, batchSystem, jobStore, Job._loadRootJob(jobStore), jobCache=jobCache)
コード例 #8
0
 def startToil(job, options):
     """
     Runs the toil using the given options (see Job.Runner.getDefaultOptions
     and Job.Runner.addToilOptions) starting with this job.
     
     Raises an exception if the given toil already exists.
     """
     setLoggingFromOptions(options)
     with setupToil(options) as (config, batchSystem, jobStore):
         jobStore.clean()
         if "rootJob" not in config.attrib:  #No jobs have yet been run
             # Setup the first batchjob.
             rootJob = job._serialiseFirstJob(jobStore)
         else:
             rootJob = jobStore.load(config.attrib["rootJob"])
         return mainLoop(config, batchSystem, jobStore, rootJob)
コード例 #9
0
 def _runMainLoop(self, rootJob):
     """
     Runs the main loop with the given job.
     :param toil.job.Job rootJob: The root job for the workflow.
     :rtype: Any
     """
     with RealtimeLogger(self._batchSystem, 
                         level=self.options.logLevel if self.options.realTimeLogging else None):
         # FIXME: common should not import from leader
         from toil.leader import mainLoop
         return mainLoop(config=self.config,
                         batchSystem=self._batchSystem,
                         provisioner=None,
                         jobStore=self._jobStore,
                         rootJobWrapper=rootJob,
                         jobCache=self._jobCache)
コード例 #10
0
ファイル: job.py プロジェクト: BD2KGenomics/toil-old
 def startToil(job, options):
     """
     Runs the toil using the given options (see Job.Runner.getDefaultOptions
     and Job.Runner.addToilOptions) starting with this job.
     
     Raises an exception if the given toil already exists.
     """
     setLoggingFromOptions(options)
     with setupToil(options) as (config, batchSystem, jobStore):
         jobStore.clean()
         if "rootJob" not in config.attrib: #No jobs have yet been run
             # Setup the first batchjob.
             rootJob = job._serialiseFirstJob(jobStore)
         else:
             rootJob = jobStore.load(config.attrib["rootJob"])
         return mainLoop(config, batchSystem, jobStore, rootJob)
コード例 #11
0
ファイル: job.py プロジェクト: adamnovak/toil
     def startToil(job, options):
         """
         Runs the toil workflow using the given options 
         (see Job.Runner.getDefaultOptions and Job.Runner.addToilOptions) 
         starting with this job. 
         
         :raises: toil.leader.FailedJobsException if at the end of function their remain
 failed jobs
         """
         setLoggingFromOptions(options)
         with setupToil(options, userScript=job.getUserScript()) as (config, batchSystem, jobStore):
             if options.restart:
                 jobStore.clean() #This cleans up any half written jobs after a restart
                 rootJob = job._loadRootJob(jobStore)
             else:
                 #Setup the first wrapper.
                 rootJob = job._serialiseFirstJob(jobStore)
             return mainLoop(config, batchSystem, jobStore, rootJob)
コード例 #12
0
ファイル: job.py プロジェクト: benedictpaten/toil
     def startToil(job, options):
         """
         Runs the toil workflow using the given options 
         (see Job.Runner.getDefaultOptions and Job.Runner.addToilOptions) 
         starting with this job. 
         
         :raises: toil.leader.FailedJobsException if at the end of function their remain
 failed jobs
         """
         setLoggingFromOptions(options)
         with setupToil(options, userScript=job.getUserScript()) as (config, batchSystem, jobStore):
             if options.restart:
                 jobStore.clean() #This cleans up any half written jobs after a restart
                 rootJob = job._loadRootJob(jobStore)
             else:
                 #Setup the first wrapper.
                 rootJob = job._serialiseFirstJob(jobStore)
             return mainLoop(config, batchSystem, jobStore, rootJob)