コード例 #1
0
ファイル: models.py プロジェクト: billyziege/pipeline_project
 def __handle_linear_steps__(self,configs,mockdb,storage_devices=None,skip_finish=False,*args,**kwargs):
     if not self.__check_first_step__(configs["pipeline"]):
         things_to_do_if_starting_pipeline(configs,mockdb,self)
         return 1
     step_order, step_objects = self.__steps_to_objects__(configs["system"],configs["pipeline"],mockdb)
     prev_step_key = step_order[0]
     for current_step_key in step_order[1:]:
         if configs["system"].get("Logging","debug") is "True":
             print current_step_key
         if step_objects[current_step_key] is None: #This means the variable name in "current step" hasn't begun (and is really the next step)
             if configs["system"].get("Logging","debug") is "True":
                 print "  Checking to see if this process should begin" 
                 print "    by checking if "+prev_step_key+" is complete" 
             if step_objects[prev_step_key].__is_complete__(configs,mockdb,*args,**kwargs):
                 if configs["system"].get("Logging","debug") is "True":
                    print "  It should" 
                 step_objects[prev_step_key].__finish__(*args,**kwargs)
                 step_objects = begin_next_step(configs,mockdb,self,step_objects,current_step_key,prev_step_key)
             return False
         prev_step_key = current_step_key
     if step_objects[prev_step_key].__is_complete__(configs,mockdb,*args,**kwargs): #Check to see if the last step has completed.:
         step_objects[prev_step_key].__finish__(configs,*args,**kwargs)
         if not skip_finish:
             if not storage_devices is None:
                 self.__finish__(storage_device=storage_devices[self.running_location],*args,**kwargs)
             else:
                 self.__finish__(*args,**kwargs)
         return True
     return False
コード例 #2
0
def run_pipeline_with_enough_space(configs,storage_devices,pipeline,mockdb):
    """
    Checks to make sure there is enough space and that the first step of the
    pipeline hasn't been started.  Then passes the pipeline to another function
    where the next steps are intiated.
    """
    if hasattr(pipeline,"zcat_key") and pipeline.zcat_key != None:
        raise FormattingError("The pipeline has a zcat key but isn't initiated.")
    #if storage_devices[pipeline.running_location].__is_available__(configs['pipeline'].get('Storage','needed')):
    storage_devices[pipeline.running_location].my_use += int(configs['pipeline'].get('Storage','needed'))
    things_to_do_if_starting_pipeline(configs,mockdb,pipeline)
    return True