# How do I set the wandb alert programatically for my current run?

**URL:** <https://community.wandb.ai/t/how-do-i-set-the-wandb-alert-programatically-for-my-current-run/4891>\
**Category:** W&B Help\
**Tags:** wandb\
**Created:** [August 11, 2023, 6:43pm UTC](https://community.wandb.ai/t/how-do-i-set-the-wandb-alert-programatically-for-my-current-run/4891 "2023-08-11T18:43:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![brando](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/brando/32/199_2.png) [@brando](https://community.wandb.ai/u/brando)\
**Post date:** [August 11, 2023, 6:43pm UTC](https://community.wandb.ai/t/how-do-i-set-the-wandb-alert-programatically-for-my-current-run/4891/1 "2023-08-11T18:43:39Z")

</div>

I want to detect if it fails. I’ve spent some time googling and chatting with chat bots. None of the options worked e.g.,

```auto
    debug: bool = mode == 'dryrun'
    run = wandb.init(mode=mode, project="beyond-scale", name=run_name, save_code=True)
    wandb.config.update({"num_batches": num_batches, "path": path, "name": name, "today": today, 'probabilities': probabilities, 'batch_size': batch_size, 'debug': debug, 'data_mixture_name': data_mixture_name})
    run.notify_on_failure()

```

failed.

What is right way to do this?

```auto
not all options worked

run.notify_on_crash()

run.notify_on_exit()

run.notify_on_failure()

run.notify_on_heartbeat()

pydevd warning: Computing repr of summary (Summary) was slow (took 60.01s) Customize report timeout by setting the PYDEVD_WARN_SLOW_RESOLVE_TIMEOUT environment variable to a higher timeout (default is: 0.5s)

Traceback (most recent call last): File "<string>", line 1, in <module> AttributeError: 'Run' object has no attribute 'notify_on_exist'

Traceback (most recent call last): File "<string>", line 1, in <module> AttributeError: 'Run' object has no attribute 'notify_on_exist'

Traceback (most recent call last): File "<string>", line 1, in <module> AttributeError: 'Run' object has no attribute 'notify_on_crash'

Traceback (most recent call last): File "<string>", line 1, in <module> AttributeError: 'Run' object has no attribute 'notify_on_exit'

Traceback (most recent call last): File "<string>", line 1, in <module> AttributeError: 'Run' object has no attribute 'notify_on_failure'

Traceback (most recent call last): File "<string>", line 1, in <module> AttributeError: 'Run' object has no attribute 'notify_on_heartbeat'

run.notify_on_abort()

Traceback (most recent call last): File "<string>", line 1, in <module> AttributeError: 'Run' object has no attribute 'notify_on_abort'

```

---

<div class="post-metadata">

**Author:** ![raphael-sanandres](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@raphael-sanandres](https://community.wandb.ai/u/raphael-sanandres)\
**Post date:** [August 15, 2023, 11:32pm UTC](https://community.wandb.ai/t/how-do-i-set-the-wandb-alert-programatically-for-my-current-run/4891/2 "2023-08-15T23:32:51Z")

</div>

Hello @brando!

Are you looking to use `wandb.alert()`([docs](https://docs.wandb.ai/guides/runs/alert))?

You can set it with something like this:

```auto
text = f"Accuracy {acc} is below acceptable threshold {thresh}"

wandb.alert(
    title="Low accuracy", 
    text=text
)

```

---

<div class="post-metadata">

**Author:** ![artsiom](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/artsiom/32/1001_2.png) [@artsiom](https://community.wandb.ai/u/artsiom)\
**Post date:** [August 18, 2023, 3:11pm UTC](https://community.wandb.ai/t/how-do-i-set-the-wandb-alert-programatically-for-my-current-run/4891/3 "2023-08-18T15:11:33Z")

</div>

Hi there, I wanted to follow up on this request. Please let us know if we can be of further assistance or if your issue has been resolved.

---

<div class="post-metadata">

**Author:** ![artsiom](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/artsiom/32/1001_2.png) [@artsiom](https://community.wandb.ai/u/artsiom)\
**Post date:** [August 22, 2023, 2:45pm UTC](https://community.wandb.ai/t/how-do-i-set-the-wandb-alert-programatically-for-my-current-run/4891/4 "2023-08-22T14:45:47Z")

</div>

Hi Brando,

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!

Warmly,  
Artsiom

---

<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 14, 2023, 11:33pm UTC](https://community.wandb.ai/t/how-do-i-set-the-wandb-alert-programatically-for-my-current-run/4891/5 "2023-10-14T23:33:10Z")

</div>

Closed on October 14, 2023, 11:33pm UTC

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