Commit 53013033 authored by Simone Rossi's avatar Simone Rossi

[fix] Sleep always after job submission

parent 91679afa
Pipeline #11295 failed with stages
in 0 seconds
...@@ -26,6 +26,7 @@ from itertools import product ...@@ -26,6 +26,7 @@ from itertools import product
import operator import operator
import time import time
from collections import Iterable, Mapping from collections import Iterable, Mapping
from typing import List, Dict
import argparse import argparse
import os, sys import os, sys
...@@ -177,9 +178,18 @@ class ParameterGrid(object): ...@@ -177,9 +178,18 @@ class ParameterGrid(object):
raise IndexError('ParameterGrid index out of range') raise IndexError('ParameterGrid index out of range')
def get_all_jobs(bin, executable, param_grid) -> list: def get_all_jobs(bin: str,
executable: str,
param_grid: Dict) -> list:
"""
Return a list of jobs for all combination of the parameters
:param bin:
:param executable:
:param param_grid:
:return:
"""
jobs = [] jobs = []
for combination in ParameterGrid(param_grid): for combination in ParameterGrid(param_grid): # type: Dict
job = bin + ' ' + executable + ' ' job = bin + ' ' + executable + ' '
for key, value in combination.items(): for key, value in combination.items():
job += '--%s=%s ' % (key, value) job += '--%s=%s ' % (key, value)
...@@ -284,11 +294,12 @@ def main(): ...@@ -284,11 +294,12 @@ def main():
number_new_jobs * zapp_memory / (1 << 30))) number_new_jobs * zapp_memory / (1 << 30)))
# Number of new jobs to schedule need to satisfy all three constrains (concurrent ex, cores and memory) # Number of new jobs to schedule need to satisfy all three constrains (concurrent ex, cores and memory)
count_next_jobs_to_schedule = min([ count_next_jobs_to_schedule = [
quota_jobs - used_jobs, quota_jobs - used_jobs,
int((quota_cores - used_cores) / zapp_cores), int((quota_cores - used_cores) / zapp_cores),
int((quota_memory - used_memory) / zapp_memory) int((quota_memory - used_memory) / zapp_memory)
]) ]
count_next_jobs_to_schedule = min(count_next_jobs_to_schedule)
if count_next_jobs_to_schedule > 0: if count_next_jobs_to_schedule > 0:
logger.info('Scheduling %d new jobs' % count_next_jobs_to_schedule) logger.info('Scheduling %d new jobs' % count_next_jobs_to_schedule)
...@@ -308,7 +319,8 @@ def main(): ...@@ -308,7 +319,8 @@ def main():
else: else:
logger.warning('Quota exceeded. No jobs can be scheduled now! Sleeping') logger.warning('Quota exceeded. No jobs can be scheduled now! Sleeping')
time.sleep(15)
time.sleep(15)
logger.info('All jobs have been submitted successfully! Exiting') logger.info('All jobs have been submitted successfully! Exiting')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment