Skip to content

Commit 3be070e

Browse files
committed
Deleted batch files when one run only
1 parent 2ebbd73 commit 3be070e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/imio/updates/tests/tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def mock_get_batch_config_se(var):
7676
# batch_config is the result after the first run
7777
reset(call_res, params)
7878
params["env"] = "SPACEX=GREAT"
79+
batch_config.update({"pf": "", "cf": ""})
7980
batch_config.update({"ll": 5, "kc": 5, "bn": 10})
8081
run_function_parts("a", {"batch": 10, "batching": ["a"]}, params)
8182
self.assertEqual(len(call_res), 1)

src/imio/updates/update_instances.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from datetime import datetime
44
from email.mime.multipart import MIMEMultipart
55
from email.mime.text import MIMEText
6+
from imio.pyutils.batching import batch_delete_files
67
from imio.pyutils.system import dump_var
78
from imio.pyutils.system import error
89
from imio.pyutils.system import get_git_tag
@@ -425,8 +426,8 @@ def run_function_parts(func_parts, batches_conf, params):
425426
last = 2 + yet_to_treat // batch_config["bn"] # int part
426427
if yet_to_treat % batch_config["bn"]: # modulo if p > b or p < b
427428
last += 1
428-
# if last == 2:
429-
# batch_delete_files({}, batch_config)
429+
if last == 2: # only one run, already done
430+
batch_delete_files({}, batch_config)
430431
for batch in range(first, last):
431432
if " BATCH=" in params["env"] and batch == (last - 1):
432433
params["env"] += " BATCH_LAST=1"

0 commit comments

Comments
 (0)