Skip to content
Snippets Groups Projects
Commit 8863f3fa authored by Christopher Randolph Rhodes's avatar Christopher Randolph Rhodes
Browse files

Added method to support queue-based tasks execution

parent 3776345f
No related branches found
No related tags found
No related merge requests found
......@@ -234,4 +234,6 @@ def list_tasks() -> Dict[str, TaskInfo]:
@app.put('/tasks/run/on_files')
def task_file_batch():
# new callable that parameterizes file name to acc_id, then passes this to to /tasks/*/run
pass
\ No newline at end of file
pass
# TODO: tasks to run all enqueued items
\ No newline at end of file
......@@ -69,6 +69,16 @@ class TaskCollection(object):
def list_tasks(self) -> OrderedDict:
return self._tasks
@property
def next_waiting(self):
"""
Return the task_id of the first status waiting for completion, or else None
"""
for k, v in self._tasks.items():
if v[k]['status'] == self.status_codes['waiting']:
return k
return None
def run_task(self, task_id: str):
task = self._tasks[task_id]
f = self._handles[task_id]
......@@ -137,6 +147,7 @@ class _Session(object):
raise InvalidPathError(f'Could not find {path}')
self.paths[key] = Path(path)
# TODO: option to automatically write to file e.g. in automated task queue processing
def add_accessor(self, acc: GenericImageDataAccessor, accessor_id: str = None) -> str:
"""
Add an accessor to session context
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment