@@ -200,6 +200,7 @@ def __init__(self, container):
200
200
self .start_time = None
201
201
self .end_time = None
202
202
self .environment = None
203
+ self .training_job_name = ""
203
204
204
205
def start (self , input_data_config , output_data_config , hyperparameters , environment , job_name ):
205
206
"""Starts a local training job.
@@ -244,10 +245,13 @@ def start(self, input_data_config, output_data_config, hyperparameters, environm
244
245
)
245
246
self .end_time = datetime .datetime .now ()
246
247
self .state = self ._COMPLETED
248
+ self .training_job_name = job_name
247
249
248
250
def describe (self ):
249
251
"""Placeholder docstring"""
250
252
response = {
253
+ "TrainingJobName" : self .training_job_name ,
254
+ "TrainingJobArn" : _UNUSED_ARN ,
251
255
"ResourceConfig" : {"InstanceCount" : self .container .instance_count },
252
256
"TrainingJobStatus" : self .state ,
253
257
"TrainingStartTime" : self .start_time ,
@@ -640,9 +644,8 @@ def __init__(
640
644
self .local_session = local_session or LocalSession ()
641
645
self .pipeline = pipeline
642
646
self .pipeline_description = pipeline_description
643
- now_time = datetime .datetime .now ()
644
- self .creation_time = now_time
645
- self .last_modified_time = now_time
647
+ self .creation_time = datetime .datetime .now ().timestamp ()
648
+ self .last_modified_time = self .creation_time
646
649
647
650
def describe (self ):
648
651
"""Describe Pipeline"""
@@ -666,6 +669,13 @@ def start(self, **kwargs):
666
669
execution = _LocalPipelineExecution (execution_id , self .pipeline , ** kwargs )
667
670
668
671
self ._executions [execution_id ] = execution
672
+ logger .info (
673
+ "Starting execution for pipeline %s. Execution ID is %s" ,
674
+ self .pipeline .name ,
675
+ execution_id ,
676
+ )
677
+ self .last_modified_time = datetime .datetime .now ().timestamp ()
678
+
669
679
return LocalPipelineExecutor (execution , self .local_session ).execute ()
670
680
671
681
@@ -686,17 +696,18 @@ def __init__(
686
696
self .pipeline_execution_display_name = PipelineExecutionDisplayName
687
697
self .status = _LocalExecutionStatus .EXECUTING .value
688
698
self .failure_reason = None
689
- self .creation_time = datetime .datetime .now ()
699
+ self .creation_time = datetime .datetime .now ().timestamp ()
700
+ self .last_modified_time = self .creation_time
690
701
self .step_execution = {}
691
702
self ._initialize_step_execution (self .pipeline .steps )
692
703
self .pipeline_parameters = self ._initialize_and_validate_parameters (PipelineParameters )
693
- self .blockout_steps = {}
704
+ self ._blocked_steps = {}
694
705
695
706
def describe (self ):
696
707
"""Describe Pipeline Execution."""
697
708
response = {
698
709
"CreationTime" : self .creation_time ,
699
- "LastModifiedTime" : self .creation_time ,
710
+ "LastModifiedTime" : self .last_modified_time ,
700
711
"FailureReason" : self .failure_reason ,
701
712
"PipelineArn" : self .pipeline .name ,
702
713
"PipelineExecutionArn" : self .pipeline_execution_name ,
@@ -720,23 +731,33 @@ def list_steps(self):
720
731
def update_execution_success (self ):
721
732
"""Mark execution as succeeded."""
722
733
self .status = _LocalExecutionStatus .SUCCEEDED .value
734
+ self .last_modified_time = datetime .datetime .now ().timestamp ()
735
+ logger .info ("Pipeline execution %s SUCCEEDED" , self .pipeline_execution_name )
723
736
724
737
def update_execution_failure (self , step_name , failure_message ):
725
738
"""Mark execution as failed."""
726
739
self .status = _LocalExecutionStatus .FAILED .value
727
740
self .failure_reason = f"Step { step_name } failed with message: { failure_message } "
728
- logger .error ("Pipeline execution failed because step %s failed." , step_name )
741
+ self .last_modified_time = datetime .datetime .now ().timestamp ()
742
+ logger .info (
743
+ "Pipeline execution %s FAILED because step %s failed." ,
744
+ self .pipeline_execution_name ,
745
+ step_name ,
746
+ )
729
747
730
748
def update_step_properties (self , step_name , step_properties ):
731
749
"""Update pipeline step execution output properties."""
732
750
self .step_execution .get (step_name ).update_step_properties (step_properties )
751
+ logger .info ("Pipeline step %s SUCCEEDED." , step_name )
733
752
734
753
def update_step_failure (self , step_name , failure_message ):
735
754
"""Mark step_name as failed."""
736
755
self .step_execution .get (step_name ).update_step_failure (failure_message )
756
+ logger .info ("Pipeline step %s FAILED. Failure message is: %s" , step_name , failure_message )
737
757
738
758
def mark_step_executing (self , step_name ):
739
759
"""Update pipelines step's status to EXECUTING and start_time to now."""
760
+ logger .info ("Starting pipeline step: %s" , step_name )
740
761
self .step_execution .get (step_name ).mark_step_executing ()
741
762
742
763
def _initialize_step_execution (self , steps ):
@@ -749,6 +770,7 @@ def _initialize_step_execution(self, steps):
749
770
StepTypeEnum .TRANSFORM ,
750
771
StepTypeEnum .CONDITION ,
751
772
StepTypeEnum .FAIL ,
773
+ StepTypeEnum .CREATE_MODEL ,
752
774
)
753
775
754
776
for step in steps :
@@ -828,29 +850,28 @@ def __init__(
828
850
StepTypeEnum .TRAINING : self ._construct_training_metadata ,
829
851
StepTypeEnum .PROCESSING : self ._construct_processing_metadata ,
830
852
StepTypeEnum .TRANSFORM : self ._construct_transform_metadata ,
853
+ StepTypeEnum .CREATE_MODEL : self ._construct_model_metadata ,
831
854
StepTypeEnum .CONDITION : self ._construct_condition_metadata ,
832
855
StepTypeEnum .FAIL : self ._construct_fail_metadata ,
833
856
}
834
857
835
858
def update_step_properties (self , properties ):
836
859
"""Update pipeline step execution output properties."""
837
- logger .info ("Successfully completed step %s." , self .name )
838
860
self .properties = deepcopy (properties )
839
861
self .status = _LocalExecutionStatus .SUCCEEDED .value
840
- self .end_time = datetime .datetime .now ()
862
+ self .end_time = datetime .datetime .now (). timestamp ()
841
863
842
864
def update_step_failure (self , failure_message ):
843
865
"""Update pipeline step execution failure status and message."""
844
- logger .error (failure_message )
845
866
self .failure_reason = failure_message
846
867
self .status = _LocalExecutionStatus .FAILED .value
847
- self .end_time = datetime .datetime .now ()
868
+ self .end_time = datetime .datetime .now (). timestamp ()
848
869
raise StepExecutionException (self .name , failure_message )
849
870
850
871
def mark_step_executing (self ):
851
872
"""Update pipelines step's status to EXECUTING and start_time to now"""
852
873
self .status = _LocalExecutionStatus .EXECUTING .value
853
- self .start_time = datetime .datetime .now ()
874
+ self .start_time = datetime .datetime .now (). timestamp ()
854
875
855
876
def to_list_steps_response (self ):
856
877
"""Convert to response dict for list_steps calls."""
@@ -875,23 +896,27 @@ def _construct_metadata(self):
875
896
876
897
def _construct_training_metadata (self ):
877
898
"""Construct training job metadata response."""
878
- return {"TrainingJob" : {"Arn" : self .properties . TrainingJobArn }}
899
+ return {"TrainingJob" : {"Arn" : self .properties [ "TrainingJobName" ] }}
879
900
880
901
def _construct_processing_metadata (self ):
881
902
"""Construct processing job metadata response."""
882
- return {"ProcessingJob" : {"Arn" : self .properties . ProcessingJobArn }}
903
+ return {"ProcessingJob" : {"Arn" : self .properties [ "ProcessingJobName" ] }}
883
904
884
905
def _construct_transform_metadata (self ):
885
906
"""Construct transform job metadata response."""
886
- return {"TransformJob" : {"Arn" : self .properties .TransformJobArn }}
907
+ return {"TransformJob" : {"Arn" : self .properties ["TransformJobName" ]}}
908
+
909
+ def _construct_model_metadata (self ):
910
+ """Construct create model step metadata response."""
911
+ return {"Model" : {"Arn" : self .properties ["ModelName" ]}}
887
912
888
913
def _construct_condition_metadata (self ):
889
914
"""Construct condition step metadata response."""
890
- return {"Condition" : {"Outcome" : self .properties . Outcome }}
915
+ return {"Condition" : {"Outcome" : self .properties [ " Outcome" ] }}
891
916
892
917
def _construct_fail_metadata (self ):
893
918
"""Construct fail step metadata response."""
894
- return {"Fail" : {"ErrorMessage" : self .properties . ErrorMessage }}
919
+ return {"Fail" : {"ErrorMessage" : self .properties [ " ErrorMessage" ] }}
895
920
896
921
897
922
class _LocalExecutionStatus (enum .Enum ):
0 commit comments