66from typing import Any
77
88from openhexa .graphql import CurrentPipelineRunCurrentPipelineRunPipeline
9- from openhexa .sdk .client import OpenHexaClient
109from openhexa .sdk .pipelines .log_level import LogLevel
1110from openhexa .sdk .utils import Environment , get_environment , graphql
1211from openhexa .sdk .workspaces import workspace
1312
13+ from ..utils import OpenHexaClient
14+
1415
1516class 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