Skip to content

Commit ea89ee0

Browse files
committed
enable task handling
1 parent a945ece commit ea89ee0

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

scripts/automated_ingestion/ingest_bundles.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22

33
from eessi_data_object import EESSIDataAndSignatureObject
4-
from eessi_task import EESSITask
4+
from eessi_task import EESSITask, EESSITaskState
55
from eessi_task_description import EESSITaskDescription
66
from eessi_s3_bucket import EESSIS3Bucket
77
from eessi_logging import error, log_function_entry_exit, log_message, LoggingScope, LOG_LEVELS, set_logging_scopes
@@ -184,22 +184,22 @@ def main():
184184

185185
log_message(LoggingScope.GROUP_OPS, "INFO", "Created EESSITask: '%s'", task)
186186

187-
# previous_state = None
188-
# current_state = task.determine_state()
189-
# log_message(LoggingScope.GROUP_OPS, "INFO", "Task '%s' is in state '%s'",
190-
# task_path, current_state.name)
191-
# while (current_state is not None and
192-
# current_state != TaskState.DONE and
193-
# previous_state != current_state):
194-
# previous_state = current_state
195-
# log_message(LoggingScope.GROUP_OPS, "INFO",
196-
# "Task '%s': BEFORE handle(): previous state = '%s', current state = '%s'",
197-
# task_path, previous_state.name, current_state.name)
198-
# current_state = task.handle()
199-
# log_message(LoggingScope.GROUP_OPS, "INFO",
200-
# "Task '%s': AFTER handle(): previous state = '%s', current state = '%s'",
201-
# task_path, previous_state.name, current_state.name)
202-
#
187+
previous_state = None
188+
current_state = task.determine_state()
189+
log_message(LoggingScope.GROUP_OPS, "INFO", "Task '%s' is in state '%s'",
190+
task_path, current_state.name)
191+
while (current_state is not None and
192+
current_state != EESSITaskState.DONE and
193+
previous_state != current_state):
194+
previous_state = current_state
195+
log_message(LoggingScope.GROUP_OPS, "INFO",
196+
"Task '%s': BEFORE handle(): previous state = '%s', current state = '%s'",
197+
task_path, previous_state.name, current_state.name)
198+
current_state = task.handle()
199+
log_message(LoggingScope.GROUP_OPS, "INFO",
200+
"Task '%s': AFTER handle(): previous state = '%s', current state = '%s'",
201+
task_path, previous_state.name, current_state.name)
202+
203203
except Exception as err:
204204
log_message(LoggingScope.ERROR, "ERROR", "Failed to process task '%s': '%s'", task_path, str(err))
205205
continue

0 commit comments

Comments
 (0)