@@ -23,16 +23,35 @@ class ExecutionEntity(Base):
2323 models_processed = Column (Integer , nullable = True )
2424
2525 def __str__ (self ):
26- if self .status == Constants .ExecutionStatus .STARTED :
27- return f"Started Execution ID: { self .execution_id } at { self .started_on } "
28-
29- total_execution_seconds = self .execution_time_s
30- execution_hours = total_execution_seconds // 3600
31- execution_minutes = (total_execution_seconds // 60 ) % 60
32- execution_seconds = total_execution_seconds % 60
33-
34- return f"Completed Execution ID: { self .execution_id } " \
35- f"; Models Processed: { self .models_processed :,} " \
36- f"; Rows Processed: { self .rows_processed :,} " \
37- f"; Execution Time: { execution_hours } h { execution_minutes } m { execution_seconds } s" \
38- f"; Average rows processed per second: { (self .rows_processed // max (total_execution_seconds , 1 )):,} ."
26+ execution_time_str = None
27+ rows_per_second = None
28+
29+ if self .execution_time_s :
30+ total_execution_seconds = self .execution_time_s
31+
32+ execution_hours = total_execution_seconds // 3600
33+ execution_minutes = (total_execution_seconds // 60 ) % 60
34+ execution_seconds = total_execution_seconds % 60
35+ execution_time_str = f'{ execution_hours } h { execution_minutes } m { execution_seconds } s'
36+
37+ if self .rows_processed :
38+ rows_per_second = (self .rows_processed // max (total_execution_seconds , 1 ))
39+
40+ return 'Execution ID: {exec_id}; ' \
41+ 'Status: {status}; ' \
42+ 'Started on: {started}; ' \
43+ 'Completed on: {completed}; ' \
44+ 'Execution time: {exec_time}; ' \
45+ 'Models processed: {models}; ' \
46+ 'Batches processed: {batches};' \
47+ 'Rows processed: {rows}; ' \
48+ 'Average rows processed per second: {rows_per_second};' .format (
49+ exec_id = self .execution_id ,
50+ status = self .status ,
51+ started = self .started_on .isoformat (),
52+ completed = self .completed_on .isoformat () if self .completed_on else '' ,
53+ exec_time = execution_time_str if self .execution_time_str else '' ,
54+ models = f'{ self .models_processed :,} ' if self .models_processed else '' ,
55+ batches = f'{ self .batches_processed :,} ' if self .batches_processed else '' ,
56+ rows = f'{ self .rows_processed :,} ' if self .rows_processed else '' ,
57+ rows_per_second = f'{ rows_per_second :,} ' if rows_per_second else '' )
0 commit comments