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

Improve server-client communication error handling #6578

Open
wants to merge 2 commits into
base: 8.4.x
Choose a base branch
from

Conversation

MetRonnie
Copy link
Member

@MetRonnie MetRonnie commented Jan 28, 2025

In #6499 we added a new field to the trigger GraphQL mutation, and this unfortunately broke the ability for cylc trigger at 8.4 to work on workflows running in 8.3 (I shall term this "inter-version server-client comms").

This PR does not fix that (we don't think a fix is feasible at this stage).

An additional problem is that the error handling for server-client comms is broken - that is what this PR fixes. And it attempts to ensure we have defined format for server-client comms which should reduce the chance of breaking inter-version server-client comms in future.

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).
  • No dependency changes
  • Tests are included (or explain why tests are not needed).
  • Changelog entry included if this is a change that can affect users
  • No docs needed
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@MetRonnie MetRonnie added the bug Something is wrong :( label Jan 28, 2025
@MetRonnie MetRonnie added this to the 8.4.1 milestone Jan 28, 2025
@MetRonnie MetRonnie self-assigned this Jan 28, 2025
@MetRonnie MetRonnie force-pushed the graphql-err-handling branch from 5dd62b7 to ee3102d Compare January 28, 2025 17:19
@MetRonnie MetRonnie force-pushed the graphql-err-handling branch from ee3102d to ff80511 Compare January 29, 2025 16:24
client = WorkflowRuntimeClient(one.workflow)
with monkeypatch.context() as mp:
mp.setattr(client, 'socket', Mock(recv=mock_recv))
mp.setattr(client, 'poller', Mock())
Copy link
Member Author

@MetRonnie MetRonnie Jan 29, 2025

Choose a reason for hiding this comment

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

For future/historical reference, I originally tried mocking the poll method of client.poller, i.e.

mp.setattr(client.poller, 'poll', Mock())

but this resulted in pytest hanging near the end of running all integration tests; some strange interaction due to the ZMQ poller using threading or something, dunno.

Anyway, this monkeypatching is needed to get client.poller.poll() to return a truthy value so the socket can receive the mock response

# receive response
if self.poller.poll(timeout):
res = await self.socket.recv()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is wrong :(
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant