From e60d96e59799ba9ca8fa371607bf0d148739f382 Mon Sep 17 00:00:00 2001 From: Andrii Ieroshenko Date: Wed, 11 Sep 2024 09:22:56 -0700 Subject: [PATCH] add execute_workflow option to DefaultExecutionManager --- jupyter_scheduler/executors.py | 11 +++++------ jupyter_scheduler/scheduler.py | 3 --- jupyter_scheduler/workflows.py | 5 +---- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/jupyter_scheduler/executors.py b/jupyter_scheduler/executors.py index b7d6ac7f..d94f5301 100644 --- a/jupyter_scheduler/executors.py +++ b/jupyter_scheduler/executors.py @@ -36,11 +36,11 @@ class ExecutionManager(ABC): def __init__( self, - job_id: str, - workflow_id: str, - root_dir: str, db_url: str, - staging_paths: Dict[str, str], + job_id: str = None, + workflow_id: str = None, + root_dir: str = None, + staging_paths: Dict[str, str] = None, ): self.job_id = job_id self.workflow_id = workflow_id @@ -86,7 +86,6 @@ def process(self): self.on_complete() def process_workflow(self): - self.before_start_workflow() try: self.execute_workflow() @@ -205,7 +204,7 @@ def get_task_data(self, task_ids: List[str] = []): return tasks_data_obj - @flow() + @flow def execute_workflow(self): tasks_info = self.get_task_data() diff --git a/jupyter_scheduler/scheduler.py b/jupyter_scheduler/scheduler.py index 18aacc5a..4489b80f 100644 --- a/jupyter_scheduler/scheduler.py +++ b/jupyter_scheduler/scheduler.py @@ -541,10 +541,7 @@ def create_workflow(self, model: CreateWorkflow) -> str: session.commit() execution_manager = self.execution_manager_class( - job_id="123", - staging_paths=dict(), workflow_id=workflow.workflow_id, - root_dir=self.root_dir, db_url=self.db_url, ) execution_manager.process_workflow() diff --git a/jupyter_scheduler/workflows.py b/jupyter_scheduler/workflows.py index 40cfb2f7..6a217c18 100644 --- a/jupyter_scheduler/workflows.py +++ b/jupyter_scheduler/workflows.py @@ -1,9 +1,8 @@ import json -from typing import List +from typing import Dict, List from jupyter_server.utils import ensure_async from tornado.web import HTTPError, authenticated - from jupyter_scheduler.exceptions import ( IdempotencyTokenError, InputUriError, @@ -26,8 +25,6 @@ async def post(self): workflow_id = await ensure_async( self.scheduler.create_workflow(CreateWorkflow(**payload)) ) - self.log.info(payload) - print(payload) except ValidationError as e: self.log.exception(e) raise HTTPError(500, str(e)) from e