Skip to content

Commit

Permalink
Adds sentinel return value to prevent sweeper from crashing (facebook…
Browse files Browse the repository at this point in the history
  • Loading branch information
OWissett committed Oct 4, 2024
1 parent 977871c commit 3f2893e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ class BaseQueueConf:
stderr_to_stdout: bool = False

# If True, the launcher will not wait for the job to finish (useful for very long runs)
# This value is not passed to submitit, it is used by the launcher itself. When enabled,
# a set of sentinel values are returned to the sweeper to indicate that the job is running.
no_block: bool = False


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
from typing import Any, Dict, List, Optional, Sequence

from hydra.core.singleton import Singleton
from hydra.core.utils import JobReturn, filter_overrides, run_job, setup_globals
from hydra.core.utils import (
JobReturn,
filter_overrides,
run_job,
setup_globals,
JobStatus,
)
from hydra.plugins.launcher import Launcher
from hydra.types import HydraContext, TaskFunction
from omegaconf import DictConfig, OmegaConf, open_dict
Expand Down Expand Up @@ -145,7 +151,8 @@ def launch(
jobs = executor.map_array(self, *zip(*job_params))

if self.no_block:
return []
sentinal = JobReturn(status=JobStatus.COMPLETED, _return_value=None)
return [sentinal] * num_jobs
else:
return [j.results()[0] for j in jobs]

Expand Down

0 comments on commit 3f2893e

Please sign in to comment.