Enqueue sweep to launch queue

Hi Wandb,
I have an existing job in a wandb project which I want to create a sweep with and enqueue that sweep to an existing Launch queue.

This is my current script with my sweep config removed:

sweep_config = {
    'method': 'random',

#initilaize wandb sweep
sweep_id = wandb.sweep(sweep=sweep_config, project="my_project")

#push sweep to launch queue
sweep_job = launch_add(job="my_user/my_project/job_name:latest", sweep_id=sweep_id, queue_name="my_queue")

When running this script I’m not returned any errors in the terminal. However, from my launch queue page on the wandb site, I see the following Stack Trace error: raise LaunchError( wandb.sdk.launch.errors.LaunchError: Launch agent picked up sweep job, but sweep (sweep id removed) was in a terminal state (PENDING)

I’m not sure if I’m incorrectly using the launch_add command or if there’s an entirely better/different way to go about my goal.

Please let me know if there’s anything you need clarified. Thanks for the help!

Hi @19kdc3 Good day and thank you for reaching out to us. Happy to help you on this!

I am thinking if the sweep has been sent to the queue already which is why the the stack trace error states that it is already on PENDING state. Are you seeing this error for other sweep IDs as well?

I want to know if the sweeps are still in PENDING state as of now. Is it possible to check this and let me know? For the meantime, I am sharing some quick link here that provide some information for best practices when using Launch. I hope this could help.

Hi @paulo-sabile! Thanks for helping me with this.

I’m not sure what would be sending it to a queue already since my understanding is that the launch_add function does that. Yes, this error occurs for any sweep created with this script and I’ve run it multiple times.

I let the sweeps sit in the pending state after showing the error for ~30 mins and nothing changes. Correct me if I’m wrong, but I assumed that once I get the stack trace error the launch_add function is terminated.

Thanks for forwarding that link. I’ve read through it already and am following those practices.