bacalhau-project / bacalhau

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

Would be great to output local debugging command #4311

Open aronchick opened 1 month ago

aronchick commented 1 month ago

When running a sample job:

bacalhau job run jobs/template_job.yaml --template-vars "fulltext=$(cat scripts/python_1_hello_world.py | base64)"

Job file:

❯ more jobs/template_job.yaml
Name: Run Over Share
Namespace: science
Type: batch
Count: 1
Tasks:
  - Name: Run over share
    InputSources:
      - Source:
          Type: localDirectory
          Params:
            SourcePath: /mnt/azureshare
        Target: /azureshare
    Publisher:
      Type: local
    Engine:
      Type: docker
      Params:
        Image: docker.io/bacalhauproject/python-runner:2024.08.08.1725
        EnvironmentVariables:
          - COMMAND={{.fulltext}}
          - B64_ENCODED=True
          - FILE_PATH=/azureshare/spliced_blc0001020304050607_guppi_57532_10225_HIP56445_0029.gpuspec.0000.h5
          - DEBUG1=True
    Resources:
      CPU: "4"
      Memory: "16GB"
      Disk: "16GB"

It'd be awesome to (somewhere) print out how to repro the job locally - like this.

docker run -e "COMMAND=$(cat scripts/python_1_hello_world.py | base64)" -e "B64_ENCODED=true" --platform=linux/amd64 docker.io/bacalhauproject/python-runner:2024.08.08.1725
wdbaruni commented 1 month ago

I agree this can be useful, but difficult to get it working for a lot of jobs as some logic in bacalhau executions is happening outside of docker, such as pulling inputs from remote sources and publishing results. Meaning, we can't support jobs with remote inputs. Also for local publishers, the destination where local results are stored is within BACALHAU_DIR and we might just create an output dir in tmp or something.

Overall, this will most likely end up a command that only sometimes work. If we still see a value in it compared to improving our logging and debuggability, then how do you see the command look like?