def update_jobs_dictionary(engine, server, jobs): """ This function checks each job in the dictionary and updates its status or removes it if the job is complete. Return the number of jobs still running. """ #Establish the running jobs counter, as we are about to update the count from the jobs report. i = 0 #get all the jobs, then inspect them for j in jobs.keys(): job_obj = job.get(server, jobs[j]) print_debug(engine["hostname"] + ": " + str(job_obj)) print_info(engine["hostname"] + ": " + j.name + ": " + job_obj.job_state) if job_obj.job_state in ["CANCELED", "COMPLETED", "FAILED"]: #If the job is in a non-running state, remove it from the running jobs list. del jobs[j] else: #If the job is in a running state, increment the running job count. i += 1 return i
def update_jobs_dictionary(engine, server, jobs): """ This function checks each job in the dictionary and updates its status or removes it if the job is complete. Return the number of jobs still running. """ # Establish the running jobs counter, as we are about to update the count from the jobs report. i = 0 # get all the jobs, then inspect them for j in jobs.keys(): job_obj = job.get(server, jobs[j]) print_debug(engine["hostname"] + ": " + str(job_obj)) print_info(engine["hostname"] + ": " + j.name + ": " + job_obj.job_state) if job_obj.job_state in ["CANCELED", "COMPLETED", "FAILED"]: # If the job is in a non-running state, remove it from the running jobs list. del jobs[j] else: # If the job is in a running state, increment the running job count. i += 1 return i