Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Update tui test KGO

added a test
  • Loading branch information
wxtim committed Jun 28, 2024
1 parent d715aff commit 0667309
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 6 deletions.
1 change: 1 addition & 0 deletions changes.d/fix.6176.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug where jobs which fail to submit are not shown in GUI/TUI if submission retries are set.
3 changes: 2 additions & 1 deletion cylc/flow/task_events_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1536,10 +1536,11 @@ def _insert_task_job(
job_conf = itask.jobs[-1]

# insert job into data store
job_status = 'submitted' if submit_status == 0 else 'submit-failed'
self.data_store_mgr.insert_job(
itask.tdef.name,
itask.point,
itask.state.status,
job_status,
{
**job_conf,
# NOTE: the platform name may have changed since task
Expand Down
46 changes: 43 additions & 3 deletions tests/integration/test_task_events_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from cylc.flow.task_events_mgr import TaskJobLogsRetrieveContext
from cylc.flow.scheduler import Scheduler

from itertools import product
import logging
from typing import Any as Fixture

from cylc.flow.task_events_mgr import TaskJobLogsRetrieveContext
from cylc.flow.scheduler import Scheduler
from cylc.flow.data_store_mgr import TASK_STATUSES_ORDERED


async def test_process_job_logs_retrieval_warns_no_platform(
one_conf: Fixture, flow: Fixture, scheduler: Fixture, run: Fixture,
Expand Down Expand Up @@ -99,3 +101,41 @@ async def test__insert_task_job(flow, one_conf, scheduler, start, validate):
i.submit_num for i
in schd.data_store_mgr.added['jobs'].values()
] == [1, 2]


async def test__always_insert_task_job(
flow, one_conf, scheduler, start, validate
):
"""Insert Task Job _Always_ inserts a task into the data store.
Bug https://github.com/cylc/cylc-flow/issues/6172 was caused
by passing task state to data_store_mgr.insert_job: Where
a submission retry was in progress the task state would be
"waiting" which caused the data_store_mgr.insert_job
to return without adding the task to the data store.
n.b. future debuggers may with to convert the for loop to
pytest parameterization for ease of debugging, but the test is
very much faster with the parameterization inside.
"""
conf = {
'scheduler': {'allow implicit tasks': True},
'scheduling': {'graph': {'R1': 'skarloey'}},
}
id_ = flow(conf)
schd = scheduler(id_)
async with start(schd):
# Set task to running:
itask = schd.pool.get_tasks()[0]
for count, (submit_status, task_status) in enumerate(
product([1, 0], TASK_STATUSES_ORDERED)
):
itask.state.status = task_status
itask.submit_num += 1

# Insert task (twice):
schd.task_events_mgr._insert_task_job(
itask, 'now', submit_status)

# Number of jobs increments _every_ time
assert len(schd.data_store_mgr.added['jobs']) == count + 1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<span style="color:#000000;background:#e5e5e5">-</span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">~cylc </span>
<span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5"></span><span style="color:#e5e5e5;background:#000000">-</span><span style="color:#000000;background:#e5e5e5"></span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5;font-weight:bold">one</span><span style="color:#000000;background:#e5e5e5"> - </span><span style="color:#cdcd00;background:#e5e5e5">paused</span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#00cd00;background:#e5e5e5">1■</span><span style="color:#000000;background:#e5e5e5"> </span>
<span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">-</span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">● 1 </span>
<span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">b </span>
<span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">+</span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5"></span><span style="color:#00cd00;background:#e5e5e5"></span><span style="color:#000000;background:#e5e5e5"> b </span>
<span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">-</span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">̿○ 2 </span>
<span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">-</span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">̿○ A </span>
<span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">̿○ a </span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<span style="color:#000000;background:#e5e5e5">-</span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">~cylc </span>
<span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">-</span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5;font-weight:bold">one</span><span style="color:#000000;background:#e5e5e5"> - </span><span style="color:#cdcd00;background:#e5e5e5">paused</span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#00cd00;background:#e5e5e5">1■</span><span style="color:#000000;background:#e5e5e5"> </span>
<span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">-</span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">̿○ 1 </span>
<span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5"></span><span style="color:#e5e5e5;background:#000000"> </span><span style="color:#000000;background:#e5e5e5"></span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">a </span>
<span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5"></span><span style="color:#e5e5e5;background:#000000">+</span><span style="color:#000000;background:#e5e5e5"></span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5"></span><span style="color:#00cd00;background:#e5e5e5"></span><span style="color:#000000;background:#e5e5e5"> a </span>
<span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">̿○ z </span>
<span style="color:#000000;background:#e5e5e5"> </span>
<span style="color:#000000;background:#e5e5e5"> </span>
Expand Down

0 comments on commit 0667309

Please sign in to comment.