bacalhau-project / bacalhau

Compute over Data framework for public, transparent, and optionally verifiable computation
https://docs.bacalhau.org
Apache License 2.0
642 stars 85 forks source link

add Queued state and history event #4115

Open wdbaruni opened 1 week ago

wdbaruni commented 1 week ago

This PR improves the visibility of queued jobs by adding a new history event, dedicated job state, and enables updating the job state from running back to queued if necessary.

This change includes:

Issues

This change breaks existing clients. Planning to add a middleware in a followup PR that will fail requests coming from outdated clients with a user friendly message asking them to upgrade their client.

Example Output

Old Format

→       bacalhau job describe j-ae5403b8-0934-4d86-a6e0-31e2f981f021
ID            = j-ae5403b8-0934-4d86-a6e0-31e2f981f021
Name          = j-ae5403b8-0934-4d86-a6e0-31e2f981f021
Namespace     = default
Type          = batch
State         = Completed
Count         = 1
Created Time  = 2024-06-21 09:18:10
Modified Time = 2024-06-21 09:18:10
Version       = 0

Summary
Completed = 1

Job History
 TIME                 REV.  STATE      TOPIC       EVENT
 2024-06-21 09:18:10  1     Pending    Submission  Job submitted
 2024-06-21 09:18:10  2     Running
 2024-06-21 09:18:10  3     Completed

Executions
 ID          NODE ID   STATE      DESIRED  REV.  CREATED    MODIFIED   COMMENT
 e-6403a485  QmPLPUUj  Completed  Stopped  6     4h37m ago  4h37m ago  Accepted job

Execution e-6403a485 History
 TIME                 REV.  STATE              TOPIC            EVENT
 2024-06-21 09:18:10  1     New
 2024-06-21 09:18:10  2     AskForBid
 2024-06-21 09:18:10  3     AskForBidAccepted  Requesting Node  Accepted job
 2024-06-21 09:18:10  4     AskForBidAccepted
 2024-06-21 09:18:10  5     BidAccepted
 2024-06-21 09:18:10  6     Completed

Standard Output
heelo

New Format

ID            = j-ccc2a592-d0a8-4dec-9bc8-9e198bb0e8f0
Name          = j-ccc2a592-d0a8-4dec-9bc8-9e198bb0e8f0
Namespace     = default
Type          = batch
State         = Pending
Count         = 1
Created Time  = 2024-06-21 17:03:06
Modified Time = 2024-06-21 17:03:06
Version       = 0

Summary
AskForBid = 1

Job History
 TIME                 TOPIC       EVENT
 2024-06-21 19:03:06  Submission  Job submitted

Executions
 ID          NODE ID  STATE      DESIRED  REV.  CREATED  MODIFIED  COMMENT
 e-b07974f7  node-2   AskForBid  Pending  2     1s ago   1s ago

Execution e-b07974f7 History
 TIME                 TOPIC         EVENT
 2024-06-21 19:03:06  Scheduling    Execution created
 2024-06-21 19:03:06  State Update  AskForBid

New Format with Queueing

ID            = j-4f1b0d3b-0a1e-4a7f-8fb9-63740a04f0c3
Name          = j-4f1b0d3b-0a1e-4a7f-8fb9-63740a04f0c3
Namespace     = default
Type          = batch
State         = Queued
Message       = Job queued. not enough nodes to run job. requested: 1, available: 3, suitable: 0.
• 3 of 3 nodes: does not support docker, only wasm
Count         = 1
Created Time  = 2024-06-21 17:41:23
Modified Time = 2024-06-21 17:41:23
Version       = 0

Summary

Job History
 TIME                 TOPIC       EVENT
 2024-06-21 19:41:23  Submission  Job submitted
 2024-06-21 19:41:23  Queueing    Job queued. not enough nodes to run job. requested: 1, available: 3, suitable: 0.
                                  • 3 of 3 nodes: does not support docker, only wasm

Executions
 ID  NODE ID  STATE  DESIRED  REV.  CREATED  MODIFIED  COMMENT

Closes #3991 Closes #4101

coderabbitai[bot] commented 1 week ago

[!IMPORTANT]

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
wdbaruni commented 1 week ago

not sure how TestDockerRunSuite/TestRun_BadExecutables/bad-image-bad-executable used to pass before. It relies on node-details being printed which are off default. In the legacy print path we used to print the node details if the flag is set, or error is returned. The new print path doesn't consider errors, which is what causing that test to fail.

I've fixed that in https://github.com/bacalhau-project/bacalhau/pull/4115/commits/e00dc77c92f73eb361cdb8dba59dc3e179900175