def list_jobs(): if arguments['--state']: if re.match('RUNNING|SUSPENDED|CANCELED|COMPLETED|FAILED', arguments['--state'].upper()): pass else: print_info('The state should be one of these options:\n' 'RUNNING, SUSPENDED, CANCELED, COMPLETED, FAILED') sys.exit(1) for job_info in job.get_all(dx_session_obj.server_session, job_state=arguments['--state'].upper()): if arguments['--title']: if re.search(arguments['--title'], job_info.title, re.IGNORECASE): print( 'Action={}, Job State={}, Parent Action State={},' 'Percent Complete={}, Reference={}, Target={},' 'Target Name={}, Title={}, User={}\n'.format( job_info.action_type, job_info.job_state, job_info.parent_action_state, job_info.percent_complete, job_info.reference, job_info.target, job_info.target_name, job_info.title, job_info.user)) else: print( 'Action=%s, Job State=%s, Parent Action State=%s,' 'Percent Complete=%s, Reference=%s, Target=%s,' 'Target Name=%s, Title=%s, User=%s\n' % (job_info.action_type, job_info.job_state, job_info.parent_action_state, job_info.percent_complete, job_info.reference, job_info.target, job_info.target_name, job_info.title, job_info.user)) else: for job_info in job.get_all(dx_session_obj.server_session): if arguments['--title']: if re.search(arguments['--title'], job_info.title, re.IGNORECASE): print( 'Action=%s, Job State=%s, Parent Action State=%s,' 'Percent Complete=%s, Reference=%s, Target=%s,' 'Target Name=%s, Title=%s, User=%s\n' % (job_info.action_type, job_info.job_state, job_info.parent_action_state, job_info.percent_complete, job_info.reference, job_info.target, job_info.target_name, job_info.title, job_info.user)) else: print( 'Action=%s, Job State=%s, Parent Action State=%s,' 'Percent Complete=%s, Reference=%s, Target=%s,' 'Target Name=%s, Title=%s, User=%s\n' % (job_info.action_type, job_info.job_state, job_info.parent_action_state, job_info.percent_complete, job_info.reference, job_info.target, job_info.target_name, job_info.title, job_info.user))
def list_jobs(): if arguments['--state']: if re.match('RUNNING|SUSPENDED|CANCELED|COMPLETED|FAILED', arguments['--state'].upper()): pass else: print_info('The state should be one of these options:\n' 'RUNNING, SUSPENDED, CANCELED, COMPLETED, FAILED') sys.exit(1) for job_info in job.get_all(dx_session_obj.server_session, job_state=arguments['--state'].upper()): if arguments['--title']: if re.search(arguments['--title'], job_info.title, re.IGNORECASE): print('Action={}, Job State={}, Parent Action State={},' 'Percent Complete={}, Reference={}, Target={},' 'Target Name={}, Title={}, User={}\n'.format( job_info.action_type, job_info.job_state, job_info.parent_action_state, job_info.percent_complete, job_info.reference, job_info.target, job_info.target_name, job_info.title, job_info.user)) else: print('Action=%s, Job State=%s, Parent Action State=%s,' 'Percent Complete=%s, Reference=%s, Target=%s,' 'Target Name=%s, Title=%s, User=%s\n' % (job_info.action_type, job_info.job_state, job_info.parent_action_state, job_info.percent_complete, job_info.reference, job_info.target, job_info.target_name, job_info.title, job_info.user)) else: for job_info in job.get_all(dx_session_obj.server_session): if arguments['--title']: if re.search(arguments['--title'], job_info.title, re.IGNORECASE): print('Action=%s, Job State=%s, Parent Action State=%s,' 'Percent Complete=%s, Reference=%s, Target=%s,' 'Target Name=%s, Title=%s, User=%s\n' % (job_info.action_type, job_info.job_state, job_info.parent_action_state, job_info.percent_complete, job_info.reference, job_info.target, job_info.target_name, job_info.title, job_info.user)) else: print('Action=%s, Job State=%s, Parent Action State=%s,' 'Percent Complete=%s, Reference=%s, Target=%s,' 'Target Name=%s, Title=%s, User=%s\n' % (job_info.action_type, job_info.job_state, job_info.parent_action_state, job_info.percent_complete, job_info.reference, job_info.target, job_info.target_name, job_info.title, job_info.user))
def get_running_job(engine, target_ref): """ Function to find a running job from the DB target reference. :param engine: A Virtualization engine session object :param target_ref: Reference to the target of the running job :return: """ return job.get_all(engine, target=target_ref, job_state='RUNNING')[0].reference
def job_wait(): """ This job stops all work in the thread/process until all jobs on the engine are completed. """ # Grab all the jos on the server (the last 25, be default) all_jobs = job.get_all(server) # For each job in the list, check to see if it is running (not ended) for jobobj in all_jobs: if not (jobobj.job_state in ["CANCELED", "COMPLETED", "FAILED"]): print_debug("Waiting for " + jobobj.reference + " (currently: " + jobobj.job_state + ") to finish running against the container") # If so, wait job_context.wait(server, jobobj.reference)
def job_wait(): """ This job stops all work in the thread/process until all jobs on the engine are completed. """ #Grab all the jos on the server (the last 25, be default) all_jobs = job.get_all(server) #For each job in the list, check to see if it is running (not ended) for jobobj in all_jobs: if not (jobobj.job_state in ["CANCELED", "COMPLETED", "FAILED"]): print_debug("Waiting for " + jobobj.reference + " (currently: " + jobobj.job_state + ") to finish running against the container") #If so, wait job_context.wait(server,jobobj.reference)
def job_wait(self): """ This job stops all work in the thread/process until jobs are completed. No arguments """ # Grab all the jos on the server (the last 25, be default) all_jobs = job.get_all(self.server_session) # For each job in the list, check to see if it is running (not ended) for jobobj in all_jobs: if not (jobobj.job_state in ["CANCELED", "COMPLETED", "FAILED"]): print_debug("\nDEBUG: Waiting for %s (currently: %s) to " "finish running against the container.\n" % (jobobj.reference, jobobj.job_state)) # If so, wait job_context.wait(self.server_session, jobobj.reference)
def job_wait(self): """ This job stops all work in the thread/process until jobs are completed. No arguments """ #Grab all the jos on the server (the last 25, be default) all_jobs = job.get_all(self.server_session) #For each job in the list, check to see if it is running (not ended) for jobobj in all_jobs: if not (jobobj.job_state in ["CANCELED", "COMPLETED", "FAILED"]): print_debug('\nDEBUG: Waiting for %s (currently: %s) to ' 'finish running against the container.\n' % (jobobj.reference, jobobj.job_state)) #If so, wait job_context.wait(self.server_session, jobobj.reference)