# Wandb Sweep running bash scripts

**URL:** <https://community.wandb.ai/t/wandb-sweep-running-bash-scripts/2895>\
**Category:** W&B Help\
**Created:** [August 10, 2022, 9:12pm UTC](https://community.wandb.ai/t/wandb-sweep-running-bash-scripts/2895 "2022-08-10T21:12:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevindong](https://avatars.discourse-cdn.com/v4/letter/k/53a042/32.png) [@kevindong](https://community.wandb.ai/u/kevindong)\
**Post date:** [August 10, 2022, 9:12pm UTC](https://community.wandb.ai/t/wandb-sweep-running-bash-scripts/2895/1 "2022-08-10T21:12:38Z")

</div>

Hi,

I’d like to use Wandb sweep but running different parameter settings with bash. Is it possible?  
Or I have to have a python file as entry point to parse the parameters and execute bash from python.

Thanks,

---

<div class="post-metadata">

**Author:** ![ramit\_goolry](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@ramit\_goolry](https://community.wandb.ai/u/ramit_goolry)\
**Post date:** [August 11, 2022, 7:18pm UTC](https://community.wandb.ai/t/wandb-sweep-running-bash-scripts/2895/2 "2022-08-11T19:18:02Z")

</div>

Hi @kevindong,

This should be possible, I was able to set up a sweep config which can run a bash shell:

```auto
program: main.sh
method: random
metric:
  name: validation_loss
  goal: minimize
parameters:
  learning_rate:
    min: 0.0001
    max: 0.1
  optimizer:
    values: ["adam", "sgd"]
command:
  - ${env}
  - bash
  - ${program}
  - ${args}

```

However, there is no equivalent of `wandb.log` for bash, so there is no way to communicate any data back to W&B.

Thanks,  
Ramit

---

<div class="post-metadata">

**Author:** ![kevindong](https://avatars.discourse-cdn.com/v4/letter/k/53a042/32.png) [@kevindong](https://community.wandb.ai/u/kevindong)\
**Post date:** [August 12, 2022, 11:26pm UTC](https://community.wandb.ai/t/wandb-sweep-running-bash-scripts/2895/3 "2022-08-12T23:26:08Z")

</div>

Thanks Ramit. your code above works.

However, if I use bash script as the ${program}, it seems the wandb server can’t know if the run is successful or not. All runs started in such a way will end up as “Crashed” state in the sweep table on the webapp

---

<div class="post-metadata">

**Author:** ![kevindong](https://avatars.discourse-cdn.com/v4/letter/k/53a042/32.png) [@kevindong](https://community.wandb.ai/u/kevindong)\
**Post date:** [August 12, 2022, 11:28pm UTC](https://community.wandb.ai/t/wandb-sweep-running-bash-scripts/2895/4 "2022-08-12T23:28:25Z")

</div>

How does Wandb determine the status code?

---

<div class="post-metadata">

**Author:** ![ramit\_goolry](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@ramit\_goolry](https://community.wandb.ai/u/ramit_goolry)\
**Post date:** [August 16, 2022, 11:20pm UTC](https://community.wandb.ai/t/wandb-sweep-running-bash-scripts/2895/5 "2022-08-16T23:20:20Z")

</div>

Hey Kevin,

W&B will not be able to send off a status code if you are operating directly through bash - the exit code is communicated to our servers through `wandb.finish`, which is written for python.

You might want to set up an entrypoint through python and run your bash script through there if you are looking to interact with W&B more.

---

<div class="post-metadata">

**Author:** ![ramit\_goolry](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@ramit\_goolry](https://community.wandb.ai/u/ramit_goolry)\
**Post date:** [August 22, 2022, 8:38pm UTC](https://community.wandb.ai/t/wandb-sweep-running-bash-scripts/2895/6 "2022-08-22T20:38:41Z")

</div>

Hi Kevin,

We wanted to follow up with you regarding your support request as we have not heard back from you. Please let us know if we can be of further assistance or if your issue has been resolved.

Best,  
Weights & Biases

---

<div class="post-metadata">

**Author:** ![ramit\_goolry](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@ramit\_goolry](https://community.wandb.ai/u/ramit_goolry)\
**Post date:** [August 25, 2022, 10:11pm UTC](https://community.wandb.ai/t/wandb-sweep-running-bash-scripts/2895/7 "2022-08-25T22:11:09Z")

</div>

Hi Kevin, since we have not heard back from you we are going to close this request. If you would like to re-open the conversation, please let us know!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/wandb/original/1X/366b649231631dbab896843020da0056074ac79d.png) [@system](https://community.wandb.ai/u/system)\
**Post date:** [October 15, 2022, 11:20pm UTC](https://community.wandb.ai/t/wandb-sweep-running-bash-scripts/2895/8 "2022-10-15T23:20:34Z")

</div>

Closed on October 15, 2022, 11:20pm UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
