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

Check for online agents when submitting a job #423

Merged
merged 1 commit into from
Dec 11, 2024
Merged

Conversation

plars
Copy link
Collaborator

@plars plars commented Dec 1, 2024

Description

This implements a new server API to get a list of the agents listening on a queue. That's used by the CLI to figure out if any of them are online before submitting a job. If there are no agents listening on the specified queue, or if all of them are offline, then it uses a new parameter to the CLI to determine what to do: --wait-for-available-agents

If that flag is used, then it will warn the user that no agents seem to be listening, and wait for the job to run anyway. Otherwise, the default behavior is to print an error and exit, failing to submit the job.

Resolved issues

CERTTF-338

Documentation

Added API documentation to the server README.rst and also extended the schema so that the /docs API reference is updated.

Web service API changes

This is detailed in the API reference (/docs path on the server) as well as in the README.rst for the server:

** [GET] /v1/queues/<queue_name>/agents** - Get the list of agents listening to a specified queue

  • Parameters:
    • queue_name (string): name of the queue for which to get the agents that are listening to it
  • Returns:
    • JSON array of agents listening to the specified queue
  • Example:
$ curl http://localhost:8000/v1/queues/foo/agents

Tests

Tested locally and with added unit tests

@plars plars marked this pull request as draft December 1, 2024 03:56
@plars
Copy link
Collaborator Author

plars commented Dec 1, 2024

I'm aware of the pylint issue, but Pedro already has a nice fix for this in a branch he's working on, so I'll merge it with that once his lands
UPDATE: That other PR has landed and this is rebased, which resolved it as expected

@plars plars force-pushed the check-for-online-agents branch from 67b122c to ec8dadc Compare December 4, 2024 03:56
@plars plars force-pushed the check-for-online-agents branch from ec8dadc to 0d32d72 Compare December 4, 2024 16:01
@plars plars marked this pull request as ready for review December 4, 2024 16:18
@plars plars requested a review from a team December 4, 2024 16:18
Copy link
Contributor

@pedro-avalos pedro-avalos left a comment

Choose a reason for hiding this comment

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

Looks good

@plars plars merged commit 51bf4c8 into main Dec 11, 2024
3 checks passed
@plars plars deleted the check-for-online-agents branch December 11, 2024 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants