|
36 | 36 | from cylc.flow.data_store_mgr import (
|
37 | 37 | JOBS,
|
38 | 38 | TASK_PROXIES,
|
| 39 | + task_mean_elapsed_time, |
39 | 40 | )
|
40 | 41 | from cylc.flow.id import TaskTokens
|
41 | 42 | from cylc.flow.scheduler import Scheduler
|
|
48 | 49 | from cylc.flow.task_proxy import TaskProxy
|
49 | 50 | from cylc.flow.task_state import (
|
50 | 51 | TASK_STATUS_FAILED,
|
| 52 | + TASK_STATUS_PREPARING, |
51 | 53 | TASK_STATUS_SUCCEEDED,
|
52 | 54 | TASK_STATUS_WAITING,
|
53 | 55 | )
|
@@ -430,3 +432,31 @@ def data_store_task_state(itask: TaskProxy):
|
430 | 432 | await schd.update_data_structure()
|
431 | 433 | assert db_task_states(foo) == expected
|
432 | 434 | assert data_store_task_state(foo) == TASK_STATUS_SUCCEEDED
|
| 435 | + |
| 436 | + |
| 437 | +async def test_timings(one_conf, flow, scheduler, start, caplog): |
| 438 | + """Test that setting outputs does not change the task timings.""" |
| 439 | + wid = flow({ |
| 440 | + **one_conf, |
| 441 | + 'runtime': { |
| 442 | + 'one': { |
| 443 | + 'execution time limit': 'PT100S', |
| 444 | + }, |
| 445 | + }, |
| 446 | + }) |
| 447 | + schd: Scheduler = scheduler(wid) |
| 448 | + async with start(schd): |
| 449 | + itask = schd.pool.get_tasks()[0] |
| 450 | + |
| 451 | + def check_times(): |
| 452 | + assert not itask.tdef.elapsed_times |
| 453 | + assert task_mean_elapsed_time(itask.tdef) == 100 |
| 454 | + |
| 455 | + itask.state_reset(TASK_STATUS_PREPARING) |
| 456 | + schd.task_events_mgr.process_message( |
| 457 | + itask, 'INFO', TASK_OUTPUT_STARTED |
| 458 | + ) |
| 459 | + check_times() |
| 460 | + |
| 461 | + await run_cmd(set_prereqs_and_outputs(schd, [itask.identity], [])) |
| 462 | + check_times() |
0 commit comments