File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33from ..utils import OpenHexaClient
44
5- openhexa = OpenHexaClient ()
5+ _openhexa = None
66
77
8- __all__ = ["openhexa" ]
8+ def get_openhexa ():
9+ """Get the OpenHexa client instance."""
10+ global _openhexa
11+ if _openhexa is None :
12+ _openhexa = OpenHexaClient ()
13+ return _openhexa
14+
15+
16+ __all__ = ["get_openhexa" ]
Original file line number Diff line number Diff line change 66from typing import Any
77
88from openhexa .graphql import CurrentPipelineRunCurrentPipelineRunPipeline
9- from openhexa .sdk .client import OpenHexaClient
9+ from openhexa .sdk .client import get_openhexa
1010from openhexa .sdk .pipelines .log_level import LogLevel
1111from openhexa .sdk .utils import Environment , get_environment , graphql
1212from openhexa .sdk .workspaces import workspace
@@ -27,8 +27,7 @@ def _connected(self):
2727 def pipeline_run_id (self ) -> Any :
2828 """Get the current pipeline run ID."""
2929 if self ._connected :
30- # Use the OpenHexaClient to get the current pipeline run ID
31- return OpenHexaClient ().current_pipeline_run ()["id" ]
30+ return get_openhexa ().current_pipeline_run ()["id" ]
3231 else :
3332 raise RuntimeError (
3433 "CurrentRun is not connected to the OpenHEXA server. "
@@ -38,7 +37,7 @@ def pipeline_run_id(self) -> Any:
3837 def get_pipline (self ) -> CurrentPipelineRunCurrentPipelineRunPipeline :
3938 """Get the current pipeline."""
4039 if self ._connected :
41- return OpenHexaClient ().current_pipeline_run ()["pipeline" ]
40+ return get_openhexa ().current_pipeline_run ()["pipeline" ]
4241 else :
4342 raise RuntimeError (
4443 "CurrentRun is not connected to the OpenHEXA server. "
You can’t perform that action at this time.
0 commit comments