Skip to content
This repository was archived by the owner on Mar 13, 2020. It is now read-only.

Commit afa3f50

Browse files
committed
SP-149 - bug fix - log at least 1 second as execution time per model/execution
1 parent afa7a0d commit afa3f50

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

rdl/data_load_tracking/DataLoadTrackerRepository.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def complete_execution(self, execution_id, total_number_of_models,
4242
.one()
4343

4444
execution_end_time = session.query(func.now()).scalar()
45-
total_execution_seconds = (execution_end_time - current_execution.started_on).total_seconds()
45+
total_execution_seconds = max((execution_end_time - current_execution.started_on).total_seconds(), 1)
4646
total_rows_processed = self.get_execution_rows(current_execution.execution_id)
4747
total_batches_processed = self.get_execution_batches(current_execution.execution_id)
4848

@@ -82,7 +82,7 @@ def save_execution_model(self, data_load_tracker):
8282
.one()
8383

8484
execution_end_time = session.query(func.now()).scalar()
85-
total_execution_seconds = (execution_end_time - current_execution_model.started_on).total_seconds()
85+
total_execution_seconds = max((execution_end_time - current_execution_model.started_on).total_seconds(), 1)
8686

8787
current_execution_model.completed_on = execution_end_time
8888
current_execution_model.execution_time_ms = int(total_execution_seconds * 1000)

rdl/entities/execution_entity.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ def __str__(self):
4949
exec_id=self.execution_id,
5050
status=self.status,
5151
started=self.started_on.isoformat(),
52-
completed=self.completed_on.isoformat() if self.completed_on else '',
53-
exec_time=execution_time_str if 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:,.2f}' if rows_per_second else '')
52+
completed=self.completed_on.isoformat() if self.completed_on else 'n/a',
53+
exec_time=execution_time_str if execution_time_str else 'n/a',
54+
models=f'{self.models_processed:,}' if self.models_processed else 'n/a',
55+
batches=f'{self.batches_processed:,}' if self.batches_processed else 'n/a',
56+
rows=f'{self.rows_processed:,}' if self.rows_processed else 'n/a',
57+
rows_per_second=f'{rows_per_second:,.2f}' if rows_per_second else 'n/a')

rdl/entities/execution_model_entity.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ def __str__(self):
6060
load_type=load_type,
6161
status=self.status,
6262
started=self.started_on.isoformat(),
63-
completed=self.completed_on.isoformat() if self.completed_on else '',
64-
exec_time=f'{execution_time_s}s' if execution_time_s else '',
65-
batches=f'{self.batches_processed:,}' if self.batches_processed else '',
66-
rows=f'{self.rows_processed:,}' if self.rows_processed else '',
67-
rows_per_second=f'{rows_per_second:,.2f}' if rows_per_second else '')
63+
completed=self.completed_on.isoformat() if self.completed_on else 'n/a',
64+
exec_time=f'{execution_time_s}s' if execution_time_s else 'n/a',
65+
batches=f'{self.batches_processed:,}' if self.batches_processed else 'n/a',
66+
rows=f'{self.rows_processed:,}' if self.rows_processed else 'n/a',
67+
rows_per_second=f'{rows_per_second:,.2f}' if rows_per_second else 'n/a')

0 commit comments

Comments
 (0)