Skip to content

Commit

Permalink
Deleted batch files when one run only
Browse files Browse the repository at this point in the history
  • Loading branch information
sgeulette committed Aug 30, 2024
1 parent 2ebbd73 commit 3be070e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/imio/updates/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def mock_get_batch_config_se(var):
# batch_config is the result after the first run
reset(call_res, params)
params["env"] = "SPACEX=GREAT"
batch_config.update({"pf": "", "cf": ""})
batch_config.update({"ll": 5, "kc": 5, "bn": 10})
run_function_parts("a", {"batch": 10, "batching": ["a"]}, params)
self.assertEqual(len(call_res), 1)
Expand Down
5 changes: 3 additions & 2 deletions src/imio/updates/update_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from datetime import datetime
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from imio.pyutils.batching import batch_delete_files
from imio.pyutils.system import dump_var
from imio.pyutils.system import error
from imio.pyutils.system import get_git_tag
Expand Down Expand Up @@ -425,8 +426,8 @@ def run_function_parts(func_parts, batches_conf, params):
last = 2 + yet_to_treat // batch_config["bn"] # int part
if yet_to_treat % batch_config["bn"]: # modulo if p > b or p < b
last += 1
# if last == 2:
# batch_delete_files({}, batch_config)
if last == 2: # only one run, already done
batch_delete_files({}, batch_config)
for batch in range(first, last):
if " BATCH=" in params["env"] and batch == (last - 1):
params["env"] += " BATCH_LAST=1"
Expand Down

0 comments on commit 3be070e

Please sign in to comment.