Autosubmit stats fails for LOCAL platform if TASKS is not specified
Autosubmit Version
4.1.11
Summary
From https://earth.bsc.es/gitlab/es/autosubmit/-/issues/1474#note_326033, issue found by @apuiggro.
Albert had a workflow he was testing locally with 4.1.11 (correct me if the version is wrong, Albert), and RO-Crate kept failing with a ZeroDivisionError error.
RO-Crate calls the stats functions, and at some point it tries to divide the PROCESSORS by TASKS of each job. Debugging with pdb, we noticed that even though he never specified these values for his platforms, nor for his jobs, Autosubmit somehow set PROCESSSORS as 1, and TASKS as 0.
I think we discussed it some time ago (with @ltenorio, I think?) and we needed to do this processors / tasks calculation, but I do not recall the details.
However, I think we could handle it better for local platforms? Either giving a warning with something like "You must specify the number of tasks in your configuration to generate statistics" or something like that, or treat tasks as 1 when platform is local.
Steps to reproduce
Create a simple workflow and package it as RO-Crate, or try to call the stats (we didn't try the latter, but that should trigger the same part of the code). Do not set processors nor tasks anywhere.
What is the current bug behavior?
ZeroDivisionError
What is the expected correct behavior?
Either handle the case for local platform, or raise a warning or error with a clear message.
Relevant logs and/or screenshots(if applicable)
See linked issue.
Traceback (most recent call last):
File "/shared/earth/easybuild/rocky/8.4/x86_64/software/autosubmit/4.1.11-foss-2021b-Python-3.9.6/bin/autosubmit", line 36, in main
return_value = Autosubmit.parse_args()
File "/shared/earth/easybuild/rocky/8.4/x86_64/software/autosubmit/4.1.11-foss-2021b-Python-3.9.6/lib/python3.9/site-packages/autosubmit/autosubmit.py", line 771, in parse_args
return Autosubmit.archive(args.expid, noclean=args.noclean, uncompress=args.uncompress, rocrate=args.rocrate)
File "/shared/earth/easybuild/rocky/8.4/x86_64/software/autosubmit/4.1.11-foss-2021b-Python-3.9.6/lib/python3.9/site-packages/autosubmit/autosubmit.py", line 4320, in archive
Autosubmit.rocrate(expid, Path(year_path))
File "/shared/earth/easybuild/rocky/8.4/x86_64/software/autosubmit/4.1.11-foss-2021b-Python-3.9.6/lib/python3.9/site-packages/autosubmit/autosubmit.py", line 4255, in rocrate
exp_stats.calculate_statistics()
File "/shared/earth/easybuild/rocky/8.4/x86_64/software/autosubmit/4.1.11-foss-2021b-Python-3.9.6/lib/python3.9/site-packages/autosubmit/statistics/statistics.py", line 50, in calculate_statistics
job_stat = self._name_to_jobstat_dict.setdefault(job.name, JobStat(job.name, parse_number_processors(
File "/shared/earth/easybuild/rocky/8.4/x86_64/software/autosubmit/4.1.11-foss-2021b-Python-3.9.6/lib/python3.9/site-packages/autosubmit/statistics/jobs_stat.py", line 11, in __init__
self._processors = self._calculate_processing_elements(nodes, processors, tasks, processors_per_node, exclusive)
File "/shared/earth/easybuild/rocky/8.4/x86_64/software/autosubmit/4.1.11-foss-2021b-Python-3.9.6/lib/python3.9/site-packages/autosubmit/statistics/jobs_stat.py", line 43, in _calculate_processing_elements
estimated_nodes = self._estimate_requested_nodes(nodes,processors,tasks,processors_per_node)
File "/shared/earth/easybuild/rocky/8.4/x86_64/software/autosubmit/4.1.11-foss-2021b-Python-3.9.6/lib/python3.9/site-packages/autosubmit/statistics/jobs_stat.py", line 32, in _estimate_requested_nodes
return math.ceil(int(processors) / int(tasks))
ZeroDivisionError: division by zero
[CRITICAL] Unexpected error: division by zero.
Please report it to Autosubmit Developers through Git
Any other relevant information(if applicable)
()