-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR improves `GET /api/v1/orchestrator/jobs/:id` API and `bacalhau job describe :id` CLI by including execution information in the output, and printing a more human readable format instead on just spitting out the job spec in YAML. ### API Improvements `GET /api/v1/orchestrator/jobs/:id` now accepts an optional `?include="executions,history"` parameters where callers can ask for the job history and executions to be included in the response, instead of having to do separate calls to `GET /api/v1/orchestrator/jobs/:id/executions` and `GET /api/v1/orchestrator/jobs/:id/history` APIs to get the full picture of the job status. ### CLI Improvements `bacalhau job describe :id` now prints the results in different sections in a human readable format instead of the yaml spec as follows: ``` # run a job across three nodes where each print their time in nanos bacalhau docker run --concurrency 3 ubuntu -- sh -c 'echo $(date +%s%N)' # describe the job → bacalhau job describe e972a009-317e-45ec-b38e-3a40b5562141 ID = e972a009-317e-45ec-b38e-3a40b5562141 Name = e972a009-317e-45ec-b38e-3a40b5562141 Namespace = 6af4ba5fa017d0b633e574e53fc773fee950f0d8bae9f7ff4e8f46d9e8e46cb1 Type = batch State = Completed Count = 3 Created Time = 2024-02-14 13:52:56 Modified Time = 2024-02-14 13:52:57 Version = 1 Summary Completed = 3 Executions ID NODE ID STATE DESIRED REV. CREATED MODIFIED COMMENT e-0e2ff6bd node-2 Completed Stopped 6 7s ago 6s ago e-448d73d8 node-3 Completed Stopped 6 7s ago 6s ago e-48cfe90d node-1 Completed Stopped 6 7s ago 6s ago Standard Output Execution e-48cfe90d: 1707918776915793876 Execution e-0e2ff6bd: 1707918776786937043 Execution e-448d73d8: 1707918776883765584 # Describe in yaml format → bacalhau job describe e972a009-317e-45ec-b38e-3a40b5562141 --output yaml Executions: Executions: - AllocatedResources: Tasks: {} ComputeState: StateType: 7 ... Job: Constraints: [] Count: 3 CreateTime: 1707918776028710000 ID: e972a009-317e-45ec-b38e-3a40b5562141 Labels: {} Meta: bacalhau.org/client.id: 6af4ba5fa017d0b633e574e53fc773fee950f0d8bae9f7ff4e8f46d9e8e46cb1 bacalhau.org/requester.id: node-0 ModifyTime: 1707918777303266000 Name: e972a009-317e-45ec-b38e-3a40b5562141 Namespace: 6af4ba5fa017d0b633e574e53fc773fee950f0d8bae9f7ff4e8f46d9e8e46cb1 Priority: 0 Revision: 3 State: StateType: Completed Tasks: - Engine: Params: Entrypoint: null EnvironmentVariables: [] Image: ubuntu Parameters: - sh - -c - echo $(date +%s%N) WorkingDirectory: "" Type: docker Name: main Network: Type: None Publisher: Type: noop Resources: {} ResultPaths: - Name: outputs Path: /outputs Timeouts: ExecutionTimeout: 1800 Type: batch Version: 1 ``` Closes bacalhau-project/expanso-planning#402
- Loading branch information
Showing
8 changed files
with
376 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package collections | ||
|
||
import "fmt" | ||
|
||
// Pair is a generic structure that holds two values of any type. | ||
type Pair[L any, R any] struct { | ||
Left L | ||
Right R | ||
} | ||
|
||
// NewPair creates a new Pair with the given values. | ||
func NewPair[L any, R any](left L, right R) Pair[L, R] { | ||
return Pair[L, R]{Left: left, Right: right} | ||
} | ||
|
||
// String returns a string representation of the Pair. | ||
func (p Pair[L, R]) String() string { | ||
return fmt.Sprintf("(%v, %v)", p.Left, p.Right) | ||
} |
Oops, something went wrong.