@@ -478,7 +478,9 @@ def prepare_or_run_pipeline(
478
478
)
479
479
480
480
# 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
+ )
482
484
483
485
# mainly for testing purposes, we wait for the pipeline to finish
484
486
if settings .synchronous :
@@ -577,12 +579,15 @@ def fetch_status(self, run: "PipelineRunResponse") -> ExecutionStatus:
577
579
raise ValueError ("Unknown status for the pipeline execution." )
578
580
579
581
def compute_metadata (
580
- self , execution : Any
582
+ self ,
583
+ execution : Any ,
584
+ settings : SagemakerOrchestratorSettings ,
581
585
) -> Iterator [Dict [str , MetadataType ]]:
582
586
"""Generate run metadata based on the generated Sagemaker Execution.
583
587
584
588
Args:
585
589
execution: The corresponding _PipelineExecution object.
590
+ settings: The Sagemaker orchestrator settings.
586
591
587
592
Yields:
588
593
A dictionary of metadata related to the pipeline run.
@@ -599,7 +604,9 @@ def compute_metadata(
599
604
metadata [METADATA_ORCHESTRATOR_URL ] = Uri (orchestrator_url )
600
605
601
606
# 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
+ ):
603
610
metadata [METADATA_ORCHESTRATOR_LOGS_URL ] = Uri (logs_url )
604
611
605
612
yield metadata
@@ -643,11 +650,13 @@ def _compute_orchestrator_url(
643
650
@staticmethod
644
651
def _compute_orchestrator_logs_url (
645
652
pipeline_execution : Any ,
653
+ settings : SagemakerOrchestratorSettings ,
646
654
) -> Optional [str ]:
647
655
"""Generate the CloudWatch URL upon pipeline execution.
648
656
649
657
Args:
650
658
pipeline_execution: The corresponding _PipelineExecution object.
659
+ settings: The Sagemaker orchestrator settings.
651
660
652
661
Returns:
653
662
the URL querying the pipeline logs in CloudWatch on AWS.
@@ -657,10 +666,16 @@ def _compute_orchestrator_logs_url(
657
666
pipeline_execution .arn
658
667
)
659
668
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
+
660
675
return (
661
676
f"https://{ region_name } .console.aws.amazon.com/"
662
677
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"
664
679
f"$3Dpipelines-{ execution_id } -"
665
680
)
666
681
except Exception as e :
0 commit comments