Skip to content

Commit

Permalink
feat: Introduced User-Defined outputs_path for Pipeline Execution (#402)
Browse files Browse the repository at this point in the history
* used the output_path paremeter in creating the ExecutionContext within the run() method of Pipeline

* fix: Local dev

* updated the default value of the outputs_path parameter in the run() method of Pipeline and removed the default value from ExecutionContext

* fix: Applied Black

* fix: apply black

* ci(tests): Trying to fix tzlocal

---------

Co-authored-by: Maxime Jublou <jubloum@gmail.com>
Co-authored-by: FlorentLvr <48032461+FlorentLvr@users.noreply.github.com>
  • Loading branch information
3 people committed Jun 29, 2023
1 parent 9423c95 commit bf941f9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .docker/dev/docker-entrypoint.sh
Expand Up @@ -18,5 +18,7 @@ pip install -ve '/home/ftp/naas/extensions/naasai'

jupyter labextension develop --overwrite '/home/ftp/naas/extensions/naasai'

cd /home/ftp/

# Start jupyterlab.
tini -g -- "start-notebook.sh"
10 changes: 4 additions & 6 deletions naas/pipeline/pipeline.py
Expand Up @@ -39,7 +39,7 @@ class ExecutionContext:
output_dir: str = None
output_path: str = None

def __init__(self, output_dir: str = "pipeline_executions"):
def __init__(self, output_dir: str):
self.execution_id = str(uuid.uuid4())
self.output_dir = output_dir
self.timestamp = datetime.datetime.now()
Expand Down Expand Up @@ -428,7 +428,7 @@ def run(
self,
style: Literal["diagram", "progess"] = "diagram",
monitor: bool = True,
outputs_path="",
outputs_path="pipeline_executions",
):
"""Start the execution of the pipeline.
Expand All @@ -442,7 +442,7 @@ def run(
"""
if self.execution_ctx is not None:
raise PipelineAlreadyRan("This pipeline have already been executed.")
self.execution_ctx = ExecutionContext()
self.execution_ctx = ExecutionContext(outputs_path)
self.status = StepStatus.RUNNING
self.monitors = []
if monitor is True:
Expand Down Expand Up @@ -494,7 +494,6 @@ class DummyStep(Step):
"""

def __init__(self, name):

super().__init__(name)
self.output = None

Expand Down Expand Up @@ -570,7 +569,7 @@ def run(self, ctx: ExecutionContext):
)
self.status = StepStatus.COMPLETED
except Exception as e:
self.status = StepStatus.ERRORED
self.status = StepStatus.ERRORED
if not self.on_error:
raise Exception(e)

Expand All @@ -580,4 +579,3 @@ def run(self, ctx: ExecutionContext):
len(self.on_error.steps) > 0 or len(self.on_error.next_steps) > 0
):
self.on_error.run(ctx)

3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -76,7 +76,8 @@
"mprop==0.16.0",
"pydash==5.1.0",
"pyvis==0.3.0",
"rich"
"rich",
"tzlocal==2.1"
],
classifiers=[
"Programming Language :: Python :: 3.9",
Expand Down

0 comments on commit bf941f9

Please sign in to comment.