Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data store: fix incorrect task state #5650

Merged
merged 6 commits into from
Aug 1, 2023

Conversation

wxtim
Copy link
Member

@wxtim wxtim commented Jul 27, 2023

…tidied

Closes #5645

Caused by a change in #5231

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg (and conda-environment.yml if present).
  • Tests are not included because any test for this would be excessively specific.
  • CHANGES.md entry included if this is a change that can affect users
  • Docs not required
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@wxtim wxtim changed the base branch from master to 8.2.x July 27, 2023 09:40
@wxtim wxtim marked this pull request as draft July 27, 2023 09:40
@wxtim wxtim marked this pull request as draft July 27, 2023 09:40
@wxtim wxtim force-pushed the fix.fail_to_update_datastore branch from f9b9bd4 to 4a5fd3c Compare July 27, 2023 10:26
@wxtim wxtim self-assigned this Jul 27, 2023
@wxtim wxtim added this to the cylc-8.2.1 milestone Jul 27, 2023
@wxtim wxtim force-pushed the fix.fail_to_update_datastore branch 4 times, most recently from bfa514f to 8f55318 Compare July 27, 2023 12:10
@wxtim wxtim force-pushed the fix.fail_to_update_datastore branch from 8f55318 to 2ea57a5 Compare July 27, 2023 12:12
@wxtim wxtim marked this pull request as ready for review July 27, 2023 12:43
@oliver-sanders
Copy link
Member

oliver-sanders commented Jul 27, 2023

@dwsutherland any thoughts on how the has_updated variable should play with this data store method?

@oliver-sanders oliver-sanders changed the title Attempt to undo a small logic change preventing the data store being … data store: fix incorrect task state Jul 27, 2023
@dwsutherland
Copy link
Member

@dwsutherland any thoughts on how the has_updated variable should play with this data store method?

I think is because the update_data_structure method also includes non-data-store processing:

        # Database update
        self.workflow_db_mgr.put_task_pool(self.pool)
        self.update_data_store()

@wxtim wxtim requested a review from dwsutherland August 1, 2023 07:59
@dwsutherland
Copy link
Member

dwsutherland commented Aug 1, 2023

Think I reproduced this problem.. by re-triggering a succeeded task:
image

(stuck in running state)

Fixed just doing this:

(flow) sutherlander@cortex:cylc-flow$ git diff

diff --git a/cylc/flow/scheduler.py b/cylc/flow/scheduler.py

index 3e1b40403..20c6c2d4d 100644

--- a/cylc/flow/scheduler.py

+++ b/cylc/flow/scheduler.py

@@ -1755,7 +1755,7 @@ class Scheduler:

                     self.timers[self.EVENT_RESTART_TIMEOUT].stop()

                     self.is_restart_timeout_wait = False

 

-            if has_updated:

+            if has_updated or self.data_store_mgr.updates_pending:

                 # Update the datastore.

                 await self.update_data_structure(self.is_reloaded)

 

@@ -1860,7 +1860,6 @@ class Scheduler:

                 sleep(0)

         # Database update

         self.workflow_db_mgr.put_task_pool(self.pool)

-        self.update_data_store()

 

     def check_workflow_timers(self):

         """Check timers, and abort or run event handlers as configured."""

(appeared to anyway)

@dwsutherland
Copy link
Member

But I think you have it now.. will review.

Copy link
Member

@dwsutherland dwsutherland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably just remove that self.update_data_store() call under has_updated ..
This actually may have effected the state-totals (..etc), i.e. #5595 (but I have a PR for that)

cylc/flow/scheduler.py Outdated Show resolved Hide resolved
cylc/flow/scheduler.py Show resolved Hide resolved
@dwsutherland
Copy link
Member

This problem was quite pernicious, I think it made some tests flakier too (by creating a race condition with state updates .. i.e. tests/f/cylc-show/06-past-present-future.t)

@dwsutherland dwsutherland mentioned this pull request Aug 1, 2023
8 tasks
@wxtim wxtim requested a review from dwsutherland August 1, 2023 11:36
Copy link
Member

@dwsutherland dwsutherland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Copy link
Member

@oliver-sanders oliver-sanders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM:

  • Reproduced the original issue, confirmed this fixed it.
  • Jammed print statements in to check that the data store update methods were being called as expected.

@oliver-sanders oliver-sanders merged commit 5da32aa into cylc:8.2.x Aug 1, 2023
24 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants