Skip to content

Commit 865a441

Browse files
authored
fixing the sagemaker links (#3195)
1 parent 69ea314 commit 865a441

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,9 @@ def prepare_or_run_pipeline(
478478
)
479479

480480
# Yield metadata based on the generated execution object
481-
yield from self.compute_metadata(execution=execution)
481+
yield from self.compute_metadata(
482+
execution=execution, settings=settings
483+
)
482484

483485
# mainly for testing purposes, we wait for the pipeline to finish
484486
if settings.synchronous:
@@ -577,12 +579,15 @@ def fetch_status(self, run: "PipelineRunResponse") -> ExecutionStatus:
577579
raise ValueError("Unknown status for the pipeline execution.")
578580

579581
def compute_metadata(
580-
self, execution: Any
582+
self,
583+
execution: Any,
584+
settings: SagemakerOrchestratorSettings,
581585
) -> Iterator[Dict[str, MetadataType]]:
582586
"""Generate run metadata based on the generated Sagemaker Execution.
583587
584588
Args:
585589
execution: The corresponding _PipelineExecution object.
590+
settings: The Sagemaker orchestrator settings.
586591
587592
Yields:
588593
A dictionary of metadata related to the pipeline run.
@@ -599,7 +604,9 @@ def compute_metadata(
599604
metadata[METADATA_ORCHESTRATOR_URL] = Uri(orchestrator_url)
600605

601606
# URL to the corresponding CloudWatch page
602-
if logs_url := self._compute_orchestrator_logs_url(execution):
607+
if logs_url := self._compute_orchestrator_logs_url(
608+
execution, settings
609+
):
603610
metadata[METADATA_ORCHESTRATOR_LOGS_URL] = Uri(logs_url)
604611

605612
yield metadata
@@ -643,11 +650,13 @@ def _compute_orchestrator_url(
643650
@staticmethod
644651
def _compute_orchestrator_logs_url(
645652
pipeline_execution: Any,
653+
settings: SagemakerOrchestratorSettings,
646654
) -> Optional[str]:
647655
"""Generate the CloudWatch URL upon pipeline execution.
648656
649657
Args:
650658
pipeline_execution: The corresponding _PipelineExecution object.
659+
settings: The Sagemaker orchestrator settings.
651660
652661
Returns:
653662
the URL querying the pipeline logs in CloudWatch on AWS.
@@ -657,10 +666,16 @@ def _compute_orchestrator_logs_url(
657666
pipeline_execution.arn
658667
)
659668

669+
use_training_jobs = True
670+
if settings.use_training_step is not None:
671+
use_training_jobs = settings.use_training_step
672+
673+
job_type = "Training" if use_training_jobs else "Processing"
674+
660675
return (
661676
f"https://{region_name}.console.aws.amazon.com/"
662677
f"cloudwatch/home?region={region_name}#logsV2:log-groups/log-group"
663-
f"/$252Faws$252Fsagemaker$252FTrainingJobs$3FlogStreamNameFilter"
678+
f"/$252Faws$252Fsagemaker$252F{job_type}Jobs$3FlogStreamNameFilter"
664679
f"$3Dpipelines-{execution_id}-"
665680
)
666681
except Exception as e:

0 commit comments

Comments
 (0)