Skip to content

Commit 46d4e3c

Browse files
author
nazarfil
committed
fix: imports
1 parent eb2c9f1 commit 46d4e3c

2 files changed

Lines changed: 14 additions & 17 deletions

File tree

openhexa/sdk/client/__init__.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
"""OpenHexa Client."""
2-
32
from ..utils import OpenHexaClient
43

5-
_openhexa = None
6-
7-
8-
def get_openhexa():
9-
"""Get the OpenHexa client instance."""
10-
global _openhexa
11-
if _openhexa is None:
12-
_openhexa = OpenHexaClient()
13-
return _openhexa
4+
openhexa = OpenHexaClient()
145

156

16-
__all__ = ["get_openhexa"]
7+
__all__ = ["openhexa"]

openhexa/sdk/pipelines/run.py

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

88
from openhexa.graphql import CurrentPipelineRunCurrentPipelineRunPipeline
9-
from openhexa.sdk.client import OpenHexaClient
109
from openhexa.sdk.pipelines.log_level import LogLevel
1110
from openhexa.sdk.utils import Environment, get_environment, graphql
1211
from openhexa.sdk.workspaces import workspace
1312

13+
from ..utils import OpenHexaClient
14+
1415

1516
class CurrentRun:
1617
"""Represents the current run of a pipeline.
@@ -33,15 +34,20 @@ def _is_connected(self):
3334
)
3435

3536
@property
36-
def pipeline_run_id(self) -> Any:
37+
def id(self) -> Any:
3738
"""Get the current pipeline run ID."""
38-
self._is_connected()
39-
return OpenHexaClient().current_pipeline_run().id
39+
if "HEXA_RUN_ID" in os.environ:
40+
return os.environ["HEXA_RUN_ID"]
41+
else:
42+
return OpenHexaClient().current_pipeline_run().id
4043

41-
def get_pipline(self) -> CurrentPipelineRunCurrentPipelineRunPipeline:
44+
def get_pipline_info(self) -> CurrentPipelineRunCurrentPipelineRunPipeline:
4245
"""Get the current pipeline."""
4346
self._is_connected()
44-
return OpenHexaClient().current_pipeline_run().pipeline
47+
if "HEXA_RUN_ID" in os.environ:
48+
os.environ["HEXA_RUN_ID"]
49+
else:
50+
return OpenHexaClient().current_pipeline_run().pipeline
4551

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

0 commit comments

Comments
 (0)