Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def Scheduler3(self, job_list, init_list):
"""
job_list is a list of jobs to run
init_list set of `static' command used to initialise each job
"""
original_job_list = tuple(job_list)
TIME_START = time.time()
self.result_list = []
self.JobsWaiting = True
getServer = self.buildCycler(self.kc_available_server_list)
if self.once_off_tentacle_init != None:
self.sendCmdListToAll(self.once_off_tentacle_init, pause=0.5)
while self.JobsWaiting:
deferred_jobs = []
job_servers = []
for job in range(len(job_list)):
if job < len(self.kc_available_server_list):
print('\nJob %s queued for processing...' % (job+1))
server = next(getServer)
job_servers.append(server)
print("\nProcessing job %s init list ..." % (job+1))
self.sendCmdListToOne(init_list, server)
print("\nProcessing job %s delta command ..." % (job+1))
print('Job %s deferred and rescheduled.' % (job+1))
print("\nProcessing queued jobs ...")
self.runAllJobs()
for server in job_servers:
self.getDataFromOneJob(server)
arr = self.kc_tentacle_response[server]
self.result_list.append(arr)
print(type(arr))
self.clearProcessMap()
if len(deferred_jobs) > 0:
print('\nDeferred:', deferred_jobs)
job_list = deferred_jobs
else:
self.JobsWaiting = False
TIME_END = time.time()
print('\nNumber of results = %s' % len(self.result_list))
total_states = 0
## for x in range(len(self.result_list)):
def Run(self, raw_data_dump=True):
START = time.time()
self.Scheduler3(self.job_list, self.init_commands)
MID = time.time()
if raw_data_dump:
try:
self.Dump(self.result_list, self.task_id+'_raw_data')
except Exception as ex:
print('Raw data not saved', ex)
print("Data generation time = %2.2f minutes." % ((MID-START)/60.0))
def Run(self, raw_data_dump=True):
START = time.time()
self.Scheduler3(self.job_list, self.init_commands)
MID = time.time()
if raw_data_dump:
try:
self.Dump(self.result_list, self.task_id+'_raw_data')
except Exception as ex:
print('Raw data not saved', ex)
print("Data generation time = %2.2f minutes." % ((MID-START)/60.0))