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

Add RunOutput to describe cmd #648

Merged
merged 2 commits into from
Sep 21, 2022
Merged

Add RunOutput to describe cmd #648

merged 2 commits into from
Sep 21, 2022

Conversation

wdbaruni
Copy link
Collaborator

Few other things I had to do for this change to work:

  1. had to change RunCommandResult.Error of type error to RunCommandResult.ErrorMsg of type string due to failing to un/marshal error types
  2. Reset stdout and stderr files's cursors as we were reading from the end of the files and returning blank output

Sample output not Truncated

→ bacalhau_local docker run ubuntu echo Hello World --wait | xargs bacalhau_local describe
Id: 1b172d6b-b799-4c08-9404-495c87d09bd9
ClientID: 6c873b593515cfe5c6d3a7ccad987b12d2c1b872607c84468cd038bcb5c3cf65
RequesterNodeId: QmXwbRDdRVJEturtw3yTLJXxM6fWiv7tdLAUdEh3cPr6kj
Spec:
    Engine: Docker
    Verifier: Noop
    Docker:
        Image: ubuntu
        Entrypoint Command:
            - echo
            - Hello
            - World
        Submitted Env Variables: []
        CPU Allocated: ""
        Memory Allocated: ""
        Inputs: []
        Outputs: []
        Annotations: []
    Deployment:
        Concurrency: 0
        Confidence: 0
        Assigned Nodes: []
Deal:
    concurrency: 1
    confidence: 0
    minbids: 0
Shards:
    - ShardIndex: 0
      Nodes:
        - Node: QmXP2bRVZxFfz79Qm1MrU2FquvoLYxWX8ALxhW55HiuMR3
          State: Completed
          Status: 'Got results proposal of length: 0'
          Verified: true
          ResultID: QmYnaUZLWmbRTJzpx6kgxoAVT3ZAmhqWY6qWZm33v8PjNm
          RunOutput:
            Stdout: Hello World
            StdoutTruncated: false
            Stderr: ""
            StderrTruncated: false
            ExitCode: 0
            RunnerError: ""
Start Time: 2022-09-21T14:36:44.424138-07:00

Sample Output Truncated:

→ bacalhau_local docker run ubuntu printf 'A%.0s' {1..3000} --wait | xargs bacalhau_local describe
...
...
we are printing the whole input, we should also trim it
...
...
Deal:
    concurrency: 1
    confidence: 0
    minbids: 0
Shards:
    - ShardIndex: 0
      Nodes:
        - Node: QmXpbWMxiHqomdcA54XRf1jGTDpUT4iWCx4g49n6ovX3bF
          State: Completed
          Status: 'Got results proposal of length: 0'
          Verified: true
          ResultID: QmdvoQLuhYTqJtKTicDG3WBPPbWsvd1NwYG3EAi4bAmHAa
          RunOutput:
            Stdout: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            StdoutTruncated: true
            Stderr: ""
            StderrTruncated: false
            ExitCode: 0
            RunnerError: ""
Start Time: 2022-09-21T14:37:56.772455-07:00

Sample Output with an Error:

→ bacalhau_local docker run ubuntu dummy_command
→ bacalhau_local describe 25fa036c-b706-4a9d-9e32-55aa84f137a8
Id: 25fa036c-b706-4a9d-9e32-55aa84f137a8
ClientID: 6c873b593515cfe5c6d3a7ccad987b12d2c1b872607c84468cd038bcb5c3cf65
RequesterNodeId: QmXwbRDdRVJEturtw3yTLJXxM6fWiv7tdLAUdEh3cPr6kj
Spec:
    Engine: Docker
    Verifier: Noop
    Docker:
        Image: ubuntu
        Entrypoint Command:
            - dummy_command
        Submitted Env Variables: []
        CPU Allocated: ""
        Memory Allocated: ""
        Inputs: []
        Outputs: []
        Annotations: []
    Deployment:
        Concurrency: 0
        Confidence: 0
        Assigned Nodes: []
Deal:
    concurrency: 1
    confidence: 0
    minbids: 0
Shards:
    - ShardIndex: 0
      Nodes:
        - Node: QmXwbRDdRVJEturtw3yTLJXxM6fWiv7tdLAUdEh3cPr6kj
          State: Error
          Status: '[QmXwbRDd] shard: 25fa036c-b706-4a9d-9e32-55aa84f137a8:0 at state: Error error completing job due to Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "dummy_command": executable file not found in $PATH: unknown'
          Verified: false
          ResultID: ""
          RunOutput:
            Stdout: ""
            StdoutTruncated: false
            Stderr: ""
            StderrTruncated: false
            ExitCode: 0
            RunnerError: 'failed to start container: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "dummy_command": executable file not found in $PATH: unknown'
Start Time: 2022-09-21T14:39:39.231356-07:00

@wdbaruni
Copy link
Collaborator Author

@aronchick I am still questioning the benefit of RunnerError as we are catching all errors and publishing them under Status field as well.

Copy link
Collaborator

@aronchick aronchick left a comment

Choose a reason for hiding this comment

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

LGTM!

@wdbaruni wdbaruni merged commit f85099e into main Sep 21, 2022
@wdbaruni wdbaruni deleted the describe-run-output branch September 21, 2022 22:03
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.

None yet

2 participants