To store a sweep_id in a CLI environment variable and run it with wandb agent later, follow these steps:
Initialize the sweep using the wandb sweep command and provide the name of the YAML file. Optionally, provide the name of the project for the project flag (–project):
I see what you’re trying to do. You want to run a sweep after creating it within a bash script. There’s no way currently to have just the ID as the output and use it for this purpose so your awk solution should suffice for now, but I agree it’s not very elegant and I’ll forward this feedback to the relevant team.
You can use the Python sweeps API to do this better programmatically, as the Sweep ID is returned as a variable in python when you call wandb.sweep. But this may not suit you for your workflow.
Sorry for the confusion. It can be done programmatically in Python, but not in bash. Your way of getting the ID from the logs is an admittedly inelegant workaround in bash. I’ve passed this feedback to the team, and requested some way to get the ID of the sweep so you can assign it to a variable in bash.