Skip to content

Commit ac97bbb

Browse files
authored
Fixing undefined max_trials (#489)
1 parent 2409021 commit ac97bbb

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

python/batch.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ def create_condor_config(config: dict[str, Any],
7272
cfg += f'error = log/{sample_name}/'
7373
cfg += f'condor_job.{sample_name}.$(ClusterId).$(ProcId).error\n'
7474

75-
7675
cfg += 'getenv = False\n'
7776

7877
build_os = determine_os(config['fccana-dir'])
@@ -169,7 +168,7 @@ def submit_job(cmd: str, max_trials: int) -> bool:
169168
LOGGER.info('Submission successful.\n')
170169
return True
171170

172-
LOGGER.warning('Error occured while submitting, retrying...\n'
171+
LOGGER.warning('Error occurred while submitting, retrying...\n'
173172
'Trial: %i / %i\n'
174173
'Error: %s', i, max_trials, stderr)
175174
time.sleep(10)
@@ -296,7 +295,8 @@ def send_sample(config: dict[str, Any],
296295
# Create log directory
297296
current_date = datetime.datetime.fromtimestamp(
298297
datetime.datetime.now().timestamp()).strftime('%Y-%m-%d_%H-%M-%S')
299-
batch_dir = os.path.join('batch-submission-files', current_date, sample_name)
298+
batch_dir = os.path.join('batch-submission-files',
299+
current_date, sample_name)
300300
if not os.path.exists(batch_dir):
301301
os.system(f'mkdir -p {batch_dir}')
302302

@@ -396,7 +396,9 @@ def send_sample(config: dict[str, Any],
396396
else:
397397
batch_cmd = f'condor_submit {condor_config_path}'
398398
LOGGER.info('Job submission command:\n %s', batch_cmd)
399-
success = submit_job(batch_cmd, 3)
399+
400+
max_trials = 3
401+
success = submit_job(batch_cmd, max_trials)
400402
if not success:
401403
LOGGER.error('Failed submitting after: %i trials!\nAborting...',
402404
max_trials)

python/build_analysis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
LOGGER = logging.getLogger('FCCAnalyses.build')
1414

1515

16-
def run_subprocess(command: str, run_dir: str) -> None:
16+
def run_subprocess(command: list[str], run_dir: str) -> None:
1717
'''
1818
Run sub-process in specified directory.
1919
Check only the return value, otherwise keep the sub-process connected to

0 commit comments

Comments
 (0)