Skip to content

Commit

Permalink
Handle gcp RetryError when resubmitting jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
r4victor committed Aug 11, 2023
1 parent 79238a4 commit 15d2a72
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cli/dstack/_internal/hub/background/tasks/resubmit_jobs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from typing import List

import google.api_core.exceptions

from dstack._internal.backend.base import Backend
from dstack._internal.core.job import JobStatus
from dstack._internal.hub.db.models import Project
Expand All @@ -25,7 +27,12 @@ async def _resubmit_projects_jobs(projects: List[Project]):
backends = await get_backends(project)
for db_backend, backend in backends:
logger.info("Resubmitting jobs for %s backend", db_backend.name)
await run_async(_resubmit_backend_jobs, backend)
try:
await run_async(_resubmit_backend_jobs, backend)
except google.api_core.exceptions.RetryError as e:
logger.warning(
"Error when resubmitting jobs for %s backend: %s", db_backend.name, e.message
)
logger.info("Finished resubmitting jobs for %s backend", db_backend.name)
logger.info("Finished resubmitting jobs for %s project", project.name)

Expand Down

0 comments on commit 15d2a72

Please sign in to comment.