earthcube / scheduler

Scheduling approaches related to gleaner tooling
Apache License 2.0
0 stars 0 forks source link

add logic to check for duplicate gleanerio containers #107

Open valentinedwv opened 1 month ago

valentinedwv commented 1 month ago

We see error like this. This is a duplicate service in the

docker.errors.APIError: 409 Client Error for [https://portainer.geocodes-aws-dev.earthcube.org:443/api/endpoints/2/docker/v1.43/services/create](https://portainer.geocodes-aws-dev.earthcube.org/api/endpoints/2/docker/v1.43/services/create): Conflict ("rpc error: code = AlreadyExists desc = name conflicts with an existing object: service sch_usgsrc4cast_gleaner already exists")

Need to add a check. before we do the request for any set of the gleaner/nabu services. Check to see if any services with names we might create exist. If a service exists, and is not running, then delete the service.

If a service exists and is running, then toss an error that says, hey it's looks like this is already running.