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

Fix.platform is regex remote tidy fail #5445

Merged

Conversation

wxtim
Copy link
Member

@wxtim wxtim commented Mar 31, 2023

Closes #5429

@dpmatthews tagged as reviewer as reporter of original issue.

To test manually see #5429 .

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 included (or explain why tests are not needed).
  • CHANGES.md entry included if this is a change that can affect users
  • Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@wxtim wxtim self-assigned this Mar 31, 2023
@wxtim wxtim added this to the cylc-8.1.3 milestone Mar 31, 2023
@wxtim wxtim force-pushed the fix.platform_is_regex_remote_tidy_fail branch 3 times, most recently from adfa520 to 0aee582 Compare March 31, 2023 08:58
cylc/flow/platforms.py Outdated Show resolved Hide resolved
cylc/flow/platforms.py Outdated Show resolved Hide resolved
cylc/flow/task_remote_mgr.py Outdated Show resolved Hide resolved
cylc/flow/task_remote_mgr.py Outdated Show resolved Hide resolved
tests/integration/test_task_remote_mgr.py Outdated Show resolved Hide resolved
tests/integration/test_task_remote_mgr.py Show resolved Hide resolved
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, couple of minor points.

cylc/flow/task_remote_mgr.py Outdated Show resolved Hide resolved
cylc/flow/task_remote_mgr.py Outdated Show resolved Hide resolved
cylc/flow/task_remote_mgr.py Outdated Show resolved Hide resolved
cylc/flow/task_remote_mgr.py Outdated Show resolved Hide resolved
cylc/flow/task_remote_mgr.py Outdated Show resolved Hide resolved
@oliver-sanders
Copy link
Member

Gotta small lint failure.

wxtim and others added 4 commits April 11, 2023 11:04
…ote tidy

Remove broken unit test

tests for map_platforms_used_for_install_targets

unit test select_platforms_used

Test remote_tidy

Changelog

f
and replaced it by adding a "quiet" mode to
get_install_targets_platform_map.
Added test for the new quiet option.

Factored some logic from remote_tidy to a staticmethod of
TaskRemoteMgr to allow unit testing. Added unit test.

monkeypatch test to avoid actual subproc calls
@wxtim wxtim force-pushed the fix.platform_is_regex_remote_tidy_fail branch from d56e9dd to dd2a373 Compare April 11, 2023 10:53
@wxtim wxtim requested review from oliver-sanders and MetRonnie and removed request for dpmatthews April 11, 2023 10:54
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.

Tested with this workflow:

[scheduling] 
    [[graph]]           
        R1 = x => y     
        
[runtime]               
    [[x]]               
        platform = myhost01       
        script = cylc stop "${CYLC_WORKFLOW_ID}" --now --now    
    [[y]] 

and this global config:

[platforms]
  [[myhost0.]]

Where "myhost01" exists on my network (obviously edit this to match an actual host).

Before:

INFO - Workflow shutting down - REQUEST(NOW-NOW)
WARNING - Orphaned tasks:
    * 1/x (running)
ERROR - Error during shutdown
ERROR - local variable 'platform' referenced before assignment
    Traceback (most recent call last):
      File "~/cylc-flow/cylc/flow/scheduler.py", line 1756, in shutdown
        await self._shutdown(reason)
      File "~/cylc-flow/cylc/flow/scheduler.py", line 1834, in _shutdown
        self.task_job_mgr.task_remote_mgr.remote_tidy()
      File "~/cylc-flow/cylc/flow/task_remote_mgr.py", line 312, in remote_tidy
        platform['name'],
    UnboundLocalError: local variable 'platform' referenced before assignment
INFO - DONE

After:

INFO - Workflow shutting down - REQUEST(NOW-NOW)
WARNING - Orphaned tasks:
    * 1/x (running)
INFO - platform: exvcylcdev01 - remote tidy (on exvcylcdev01)
INFO - DONE

cylc/flow/exceptions.py Outdated Show resolved Hide resolved
cylc/flow/rundb.py Outdated Show resolved Hide resolved
cylc/flow/task_remote_mgr.py Show resolved Hide resolved
cylc/flow/task_remote_mgr.py Outdated Show resolved Hide resolved
Comment on lines 333 to 334
platforms_used = (
self.db_mgr.get_pri_dao().select_platforms_used())
Copy link
Member

Choose a reason for hiding this comment

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

I think we should ensure the DB is closed

Suggested change
platforms_used = (
self.db_mgr.get_pri_dao().select_platforms_used())
with self.db_mgr.get_pri_dao() as dao:
platforms_used = dao.select_platforms_used()

tests/unit/test_platforms.py Outdated Show resolved Hide resolved
tests/unit/test_rundb.py Outdated Show resolved Hide resolved
tests/unit/test_task_remote_mgr.py Outdated Show resolved Hide resolved
tests/unit/test_task_remote_mgr.py Outdated Show resolved Hide resolved
tests/unit/test_task_remote_mgr.py Outdated Show resolved Hide resolved
@wxtim wxtim force-pushed the fix.platform_is_regex_remote_tidy_fail branch from d1ff32e to 7a9da9f Compare April 17, 2023 10:41
wxtim added 2 commits April 17, 2023 11:44
…gex_remote_tidy_fail

* upstream/8.1.x:
  Update cylc/flow/scripts/message.py
  Upload coverage to Codecov in separate job (cylc#5459)
  upgrade cylc message internal help with details of severity levels
  Update tests/functional/platforms/10-do-not-host-check-platforms.t
  Fix flake8-comprehensions C419 Don't use any([i for i in iterable]) use any(i for i in iterable). It's more efficient because we don't have to expand the entire thing.
  Improve readability of host/platform eval code (#53)
  small changlog error fix
  update comment on localhost check and add test for case localhost4.localhost42
  undo mistake
  clarification of nomenclature
  Avoid running host check on platform names - this doesn't make any sense.
@wxtim wxtim requested a review from MetRonnie April 17, 2023 10:54
cylc/flow/task_remote_mgr.py Outdated Show resolved Hide resolved
cylc/flow/task_remote_mgr.py Outdated Show resolved Hide resolved
Comment on lines +348 to +349
platforms_used = (
self.db_mgr.get_pri_dao().select_task_job_platforms())
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
platforms_used = (
self.db_mgr.get_pri_dao().select_task_job_platforms())
with self.db_mgr.get_pri_dao() as dao:
platforms_used = dao.select_task_job_platforms())

@wxtim wxtim force-pushed the fix.platform_is_regex_remote_tidy_fail branch from e43c13f to 94a61da Compare April 18, 2023 08:55
@wxtim wxtim requested a review from MetRonnie April 18, 2023 08:55
Copy link
Member

@MetRonnie MetRonnie left a comment

Choose a reason for hiding this comment

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

Tested out using a regex pattern platform section in global.cylc

@wxtim
Copy link
Member Author

wxtim commented Apr 19, 2023

@oliver-sanders - Ronnie's had me make some changes since last you looked.. mind giving it another quick look?

@oliver-sanders
Copy link
Member

@wxtim, some minor conflicts with the other branch.

@oliver-sanders
Copy link
Member

Gotta couple of test failures :(

@wxtim
Copy link
Member Author

wxtim commented Apr 19, 2023

Gotta couple of test failures :(

I think that the one in tests/f/rnd is a random flake, but the other one exists on 8.1.x, so it's probably a mistake in one of my other PR's :(

@oliver-sanders
Copy link
Member

I've re-run the f/rnd test and it's failed again (so it's failed four times in a row due to retries) so it looks like it's genuine.

cylc/flow/exceptions.py Outdated Show resolved Hide resolved
cylc/flow/task_job_mgr.py Outdated Show resolved Hide resolved
wxtim and others added 2 commits April 20, 2023 16:00
@wxtim
Copy link
Member Author

wxtim commented Apr 20, 2023

I've re-run the f/rnd test and it's failed again (so it's failed four times in a row due to retries) so it looks like it's genuine.

Have you looked at what's in it?

@oliver-sanders
Copy link
Member

Merging with an unrelated test failure fixed in #5479

@oliver-sanders oliver-sanders merged commit 62f5ef5 into cylc:8.1.x Apr 21, 2023
@wxtim wxtim deleted the fix.platform_is_regex_remote_tidy_fail branch April 21, 2023 09:03
wxtim added a commit to wxtim/cylc that referenced this pull request Apr 21, 2023
…too_soon

* upstream/8.1.x:
  Fix.platform is regex remote tidy fail (cylc#5445)
  parsec: better error messages for section/setting mixups
  cat-log: change interface for scheduler logs to include the dirname
  cat-log: support other workflow files
  Fix workflow shutdown on no platforms error (cylc#5395)
  actions: add build test
@MetRonnie MetRonnie mentioned this pull request May 3, 2023
8 tasks
wxtim added a commit to wxtim/cylc that referenced this pull request May 4, 2023
…too_soon

* upstream/8.1.x: (46 commits)
  Bump dev version (cylc#5518)
  Prepare release 8.1.4
  cat-log: fix issues with file listing
  Update changelog
  Fix `eval_host()` localhost bug & plug testing gap
  Bump dev version (cylc#5501)
  Prepare release 8.1.3
  Ignore off-sequence parents, for datastore. (cylc#5495)
  Avoid duplicate prerequisites from multiple recurrences. (cylc#5466)
  tests/f: fix events/11
  swarm: convert cylc-dev Docker image to run on ubuntu:latest
  fix changelog
  Apply prerequisite changes to spawned tasks, on reload & restart (cylc#5334)
  cat-log: don't list directories which don't exist (cylc#5488)
  task_job_mgr: move compute out of open call
  manylinux tests: update to ubuntu-20.04
  Update changelog
  Address review
  Fix.platform is regex remote tidy fail (cylc#5445)
  parsec: better error messages for section/setting mixups
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants