Skip to content

Commit ed80a7a

Browse files
author
nazarfil
committed
fix: fixes pieplines
1 parent 79c4382 commit ed80a7a

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

openhexa/sdk/pipelines/run.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from typing import Any
77

88
from openhexa.graphql import CurrentPipelineRunCurrentPipelineRunPipeline
9-
from openhexa.sdk.client import get_openhexa
9+
from openhexa.sdk.client import OpenHexaClient
1010
from openhexa.sdk.pipelines.log_level import LogLevel
1111
from openhexa.sdk.utils import Environment, get_environment, graphql
1212
from openhexa.sdk.workspaces import workspace
@@ -26,8 +26,12 @@ def _connected(self):
2626
@property
2727
def pipeline_run_id(self) -> Any:
2828
"""Get the current pipeline run ID."""
29-
if self._connected:
30-
return get_openhexa().current_pipeline_run()["id"]
29+
self._is_connected()
30+
return OpenHexaClient().current_pipeline_run().id
31+
32+
def _is_connected(self):
33+
if "HEXA_SERVER_URL" in os.environ:
34+
return True
3135
else:
3236
raise RuntimeError(
3337
"CurrentRun is not connected to the OpenHEXA server. "
@@ -36,13 +40,8 @@ def pipeline_run_id(self) -> Any:
3640

3741
def get_pipline(self) -> CurrentPipelineRunCurrentPipelineRunPipeline:
3842
"""Get the current pipeline."""
39-
if self._connected:
40-
return get_openhexa().current_pipeline_run()["pipeline"]
41-
else:
42-
raise RuntimeError(
43-
"CurrentRun is not connected to the OpenHEXA server. "
44-
"Make sure to set the HEXA_SERVER_URL environment variable."
45-
)
43+
self._is_connected()
44+
return OpenHexaClient().current_pipeline_run().pipeline
4645

4746
def add_file_output(self, path: str):
4847
"""Record a run output for a file creation operation.

0 commit comments

Comments
 (0)