From e32f03c88441f3938f83da8a89f0ec7b9b2c813c Mon Sep 17 00:00:00 2001 From: jlnav Date: Tue, 7 Jul 2026 13:18:25 -0500 Subject: [PATCH 01/10] Add FluxExecutor using native Flux Python API bindings FluxExecutor submits jobs directly to Flux via its Python bindings rather than wrapping flux run as a subprocess. It is useful when running inside containers where standard MPI runners are unavailable. - New libensemble/executors/flux_executor.py with FluxExecutor and FluxTask - Conditionally import FluxExecutor in executors/__init__.py (graceful ImportError if flux-core bindings are not installed) - Append FluxExecutor unit tests to test_flux.py; tests skip automatically when flux-core Python bindings are not present --- libensemble/executors/__init__.py | 9 +- libensemble/executors/flux_executor.py | 466 ++++++++++++++++++++++ libensemble/tests/unit_tests/test_flux.py | 132 ++++++ 3 files changed, 606 insertions(+), 1 deletion(-) create mode 100644 libensemble/executors/flux_executor.py diff --git a/libensemble/executors/__init__.py b/libensemble/executors/__init__.py index 563fa33525..13c7d851d5 100644 --- a/libensemble/executors/__init__.py +++ b/libensemble/executors/__init__.py @@ -1,4 +1,11 @@ from libensemble.executors.executor import Executor from libensemble.executors.mpi_executor import MPIExecutor -__all__ = ["Executor", "MPIExecutor"] +# FluxExecutor is optional - requires flux-core Python bindings +try: + from libensemble.executors.flux_executor import FluxExecutor # noqa: F401 + + __all__ = ["Executor", "MPIExecutor", "FluxExecutor"] +except ImportError: + # flux-core not available - FluxExecutor won't be importable + __all__ = ["Executor", "MPIExecutor"] diff --git a/libensemble/executors/flux_executor.py b/libensemble/executors/flux_executor.py new file mode 100644 index 0000000000..e2b1aa2e33 --- /dev/null +++ b/libensemble/executors/flux_executor.py @@ -0,0 +1,466 @@ +""" +This module provides a native Flux executor using the Flux Python API. + +The FluxExecutor submits jobs directly to Flux using its Python bindings, +rather than wrapping `flux run` as a subprocess. This provides better +integration with Flux's job lifecycle management and is particularly +useful when running inside containers where MPI runners may not be available. + +Usage:: + + from libensemble.executors.flux_executor import FluxExecutor + + exctr = FluxExecutor() + exctr.register_app(full_path="/path/to/my_app.x", app_name="my_app") + + # In your sim function: + task = exctr.submit(app_name="my_app", num_procs=4, num_nodes=1) + task.wait() + +Requirements: + - flux-core Python bindings must be installed + - Must be running inside a Flux instance (FLUX_URI must be set) +""" + +import logging +import os +import shlex +import time + +from libensemble.executors.executor import ( + Application, + Executor, + ExecutorException, + Task, + jassert, +) + +logger = logging.getLogger(__name__) + +# Try to import flux - it's optional +try: + import flux + import flux.job + from flux.job import JobspecV1 + + FLUX_AVAILABLE = True +except ImportError: + FLUX_AVAILABLE = False + flux = None + JobspecV1 = None + + +class FluxTask(Task): + """ + Task subclass for Flux jobs using native Flux Python API. + + Overrides poll() and kill() to use Flux job management instead + of subprocess operations. + """ + + def __init__( + self, + app=None, + app_args=None, + workdir=None, + stdout=None, + stderr=None, + workerid=None, + dry_run=False, + ) -> None: + super().__init__(app, app_args, workdir, stdout, stderr, workerid, dry_run) + self.flux_handle = None + self.flux_jobid = None + self.flux_future = None + + def reset(self) -> None: + super().reset() + self.flux_jobid = None + self.flux_future = None + + def _check_poll(self) -> bool: + """Check whether polling this task makes sense.""" + jassert( + self.flux_jobid is not None, + f"task {self.name} has no Flux job ID - check task has been launched", + ) + if self.finished: + logger.debug(f"Polled task {self.name} has already finished. Not re-polling. Status is {self.state}") + return False + return True + + def poll(self) -> None: + """Polls and updates the status attributes of the task using Flux job state.""" + if self.dry_run: + self._set_complete() + return + + if not self._check_poll(): + return + + try: + info = flux.job.get_job(self.flux_handle, self.flux_jobid) + jassert(info is not None, f"Flux job {self.flux_jobid} was not found") + state = str(info.get("state", "UNKNOWN")).upper() + + # Map Flux states to libEnsemble states + # Flux states: DEPEND, PRIORITY, SCHED, RUN, CLEANUP, INACTIVE + if state in ("DEPEND", "PRIORITY", "SCHED"): + self.state = "WAITING" + elif state == "RUN": + self.state = "RUNNING" + self.runtime = self.timer.elapsed + elif state in ("CLEANUP", "INACTIVE"): + # Job has finished - check if successful + self._handle_completion(info) + else: + self.state = "UNKNOWN" + self.runtime = self.timer.elapsed + + except Exception as e: + logger.warning(f"Error polling Flux job {self.flux_jobid}: {e}") + self.state = "UNKNOWN" + self.runtime = self.timer.elapsed + + def _handle_completion(self, info: dict) -> None: + """Handle job completion and determine success/failure.""" + self.finished = True + self.calc_task_timing() + + # Check result/exit status + result = str(info.get("result", "")).upper() + success = result == "COMPLETED" or info.get("returncode", 1) == 0 + + if success: + self.success = True + self.state = "FINISHED" + self.errcode = 0 + else: + self.success = False + self.state = "FAILED" + # Try to get exit code from result + self.errcode = info.get("returncode", 1) + + logger.info(f"Task {self.name} finished with state {self.state} (result={result})") + + def _set_complete(self) -> None: + """Set task as complete (used for dry_run).""" + self.finished = True + if self.dry_run: + self.success = True + self.state = "FINISHED" + else: + self.calc_task_timing() + self.success = self.errcode == 0 + self.state = "FINISHED" if self.success else "FAILED" + logger.info(f"Task {self.name} finished with errcode {self.errcode} ({self.state})") + + def wait(self, timeout: float | None = None) -> None: + """Waits on completion of the Flux job or raises TimeoutExpired exception.""" + from libensemble.executors.executor import TimeoutExpired + + if self.dry_run: + self._set_complete() + return + + if not self._check_poll(): + return + + try: + # Wait for job to complete + start_time = time.time() + while True: + self.poll() + if self.finished: + break + + if timeout is not None: + elapsed = time.time() - start_time + if elapsed >= timeout: + raise TimeoutExpired(self.name, timeout) + + time.sleep(0.1) + + except TimeoutExpired: + raise + except Exception as e: + logger.warning(f"Error waiting for Flux job {self.flux_jobid}: {e}") + self.state = "FAILED" + self.finished = True + + def kill(self, wait_time: int | None = 60) -> None: + """Kills/cancels the Flux job. + + Parameters + ---------- + wait_time: int, Optional + Time in seconds to wait for cancellation. + Note: Flux handles job cancellation internally. + """ + self.poll() + if self.dry_run: + return + + if self.finished: + logger.warning(f"Trying to kill task that is no longer running. Task {self.name}: Status is {self.state}") + return + + if self.flux_jobid is None: + logger.warning(f"Task {self.name} has no Flux job ID - cannot kill") + return + + logger.info(f"Canceling Flux job {self.flux_jobid} for task {self.name}") + + try: + # Cancel the job using Flux API + flux.job.cancel(self.flux_handle, self.flux_jobid) + + # Wait briefly for cancellation to take effect + if wait_time: + deadline = time.time() + min(wait_time, 5) # Don't wait too long + while time.time() < deadline: + self.poll() + if self.finished: + break + time.sleep(0.1) + + except Exception as e: + logger.warning(f"Error canceling Flux job {self.flux_jobid}: {e}") + + self.state = "USER_KILLED" + self.finished = True + self.calc_task_timing() + + +class FluxExecutor(Executor): + """ + Native Flux executor using the Flux Python API. + + This executor submits jobs directly to Flux rather than wrapping + `flux run` as a subprocess. It provides better integration with + Flux's job lifecycle and is suitable for container-based workflows. + + Parameters + ---------- + None + + Raises + ------ + ExecutorException + If flux Python bindings are not available or FLUX_URI is not set. + + Example + ------- + :: + + from libensemble.executors.flux_executor import FluxExecutor + + exctr = FluxExecutor() + exctr.register_app(full_path="/path/to/sim.x", app_name="sim") + + # In sim function: + task = exctr.submit(app_name="sim", num_procs=4) + task.wait() + """ + + def __init__(self) -> None: + """Instantiate a new FluxExecutor instance.""" + if not FLUX_AVAILABLE: + raise ExecutorException( + "Flux Python bindings not available. " + "Install flux-core or use MPIExecutor with mpi_runner='flux' instead." + ) + + if not os.environ.get("FLUX_URI"): + raise ExecutorException( + "FLUX_URI environment variable not set. " "FluxExecutor must be used inside a Flux instance." + ) + + super().__init__() + + # Connect to the Flux instance + try: + self.flux_handle = flux.Flux() + except Exception as e: + raise ExecutorException(f"Failed to connect to Flux instance: {e}") + + self.resources = None + self.platform_info: dict = {} + + def set_resources(self, resources) -> None: + """Set resources for the executor.""" + self.resources = resources + + def add_platform_info(self, platform_info: dict | None = None) -> None: + """Add platform info to the executor.""" + self.platform_info = platform_info or {} + + def submit( + self, + calc_type: str | None = None, + app_name: str | None = None, + num_procs: int | None = None, + num_nodes: int | None = None, + procs_per_node: int | None = None, + num_gpus: int | None = None, + app_args: str | None = None, + stdout: str | None = None, + stderr: str | None = None, + dry_run: bool = False, + wait_on_start: bool = False, + extra_args: str | None = None, + ) -> FluxTask: + """Submit a job to Flux. + + Returns :class:`FluxTask` object. + + Parameters + ---------- + calc_type: str, Optional + The calculation type: 'sim' or 'gen' + + app_name: str, Optional + The application name. + + num_procs: int, Optional + The total number of processes (MPI ranks) + + num_nodes: int, Optional + The number of nodes + + procs_per_node: int, Optional + The processes per node + + num_gpus: int, Optional + The total number of GPUs + + app_args: str, Optional + Application arguments + + stdout: str, Optional + Standard output filename + + stderr: str, Optional + Standard error filename + + dry_run: bool, Optional + If True, don't actually submit the job + + wait_on_start: bool, Optional + Whether to wait for job to start running + + extra_args: str, Optional + Additional arguments (currently not used for native Flux) + + Returns + ------- + task: FluxTask + The submitted task object + """ + app: Application | None = None + if app_name is not None: + app = self.get_app(app_name) + elif calc_type is not None: + app = self.default_app(calc_type) + else: + raise ExecutorException("Either app_name or calc_type must be set") + + assert app is not None + + default_workdir = os.getcwd() + task = FluxTask(app, app_args, default_workdir, stdout, stderr, self.workerID, dry_run) + task.flux_handle = self.flux_handle + + if not dry_run: + self._check_app_exists(task.app) + + if extra_args: + raise ExecutorException("extra_args is not supported by FluxExecutor") + + num_procs = num_procs or 1 + if num_nodes is None: + if procs_per_node is not None: + if num_procs % procs_per_node != 0: + raise ExecutorException("num_procs must be divisible by procs_per_node for FluxExecutor") + num_nodes = num_procs // procs_per_node + else: + num_nodes = 1 + elif procs_per_node is not None and num_procs != num_nodes * procs_per_node: + raise ExecutorException("num_procs must equal num_nodes * procs_per_node for FluxExecutor") + + command = shlex.split(task.app.app_cmd) + if task.app_args: + command.extend(shlex.split(task.app_args)) + + command = self._set_sim_dir_env(task, command) + task.runline = " ".join(command) + + if dry_run: + logger.info(f"Test (No submit) Command: {task.runline}") + logger.info(f" num_procs={num_procs}, num_nodes={num_nodes}, procs_per_node={procs_per_node}") + task._set_complete() + else: + # Create Flux jobspec + try: + gpus_per_task = None + if num_gpus is not None: + if num_gpus < 0: + raise ExecutorException("num_gpus must be non-negative") + if num_gpus and num_gpus % num_procs != 0: + raise ExecutorException("num_gpus must be divisible by num_procs for FluxExecutor") + gpus_per_task = num_gpus // num_procs if num_gpus else 0 + + jobspec = JobspecV1.from_command( + command, + num_tasks=num_procs, + num_nodes=num_nodes, + cores_per_task=1, + gpus_per_task=gpus_per_task, + cwd=task.workdir, + environment=dict(os.environ), + ) + + if stdout: + jobspec.stdout = os.path.join(task.workdir, stdout) + if stderr: + jobspec.stderr = os.path.join(task.workdir, stderr) + if gpus_per_task: + jobspec.setattr_shell_option("gpu-affinity", "per-task") + + logger.info(f"Submitting Flux job for task {task.name}: {task.runline}") + task.flux_jobid = flux.job.submit(self.flux_handle, jobspec) + logger.info(f"Task {task.name} submitted with Flux job ID {task.flux_jobid}") + + task.timer.start() + task.submit_time = task.timer.tstart + + if wait_on_start: + self._wait_on_start(task) + + except Exception as e: + logger.error(f"Failed to submit Flux job: {e}") + task.state = "FAILED_TO_START" + task.finished = True + raise ExecutorException(f"Failed to submit Flux job: {e}") + + self.list_of_tasks.append(task) + return task + + def _wait_on_start(self, task: FluxTask, timeout: float = 60.0) -> None: + """Wait for a task to start running.""" + start = time.time() + task.timer.start() + task.submit_time = task.timer.tstart + + while task.state in ("CREATED", "WAITING"): + time.sleep(0.1) + task.poll() + if time.time() - start > timeout: + logger.warning(f"Timeout waiting for task {task.name} to start") + break + + if not task.finished: + task.timer.start() + task.submit_time = task.timer.tstart + + logger.debug(f"Task {task.name} polled as {task.state} after {time.time() - start:.2f} seconds") diff --git a/libensemble/tests/unit_tests/test_flux.py b/libensemble/tests/unit_tests/test_flux.py index b5f7c0e014..cc8b2a2ecf 100644 --- a/libensemble/tests/unit_tests/test_flux.py +++ b/libensemble/tests/unit_tests/test_flux.py @@ -6,6 +6,7 @@ - Flux nodelist parsing (via slurm-style bracket notation) - Flux MPI variant detection - FluxAllocation platform configuration +- FluxExecutor (when flux bindings available) """ import os @@ -15,6 +16,7 @@ import pytest +from libensemble.executors import flux_executor from libensemble.executors.mpi_runner import FLUX_MPIRunner, MPIRunner from libensemble.resources.env_resources import EnvResources from libensemble.resources.platforms import FluxAllocation, Known_platforms @@ -317,6 +319,136 @@ class MockCls: check_mpi_runner_type(MockCls, "invalid_runner") +# ======================================================================================== +# Tests for FluxExecutor (conditional on flux availability) +# ======================================================================================== + + +def test_flux_executor_import_without_flux(): + """Test FluxExecutor handles missing flux gracefully""" + # This test just verifies the module can be imported + # even when flux is not available + try: + from libensemble.executors import flux_executor + + # FLUX_AVAILABLE should be False if flux not installed + # This is fine - we just want to ensure import doesn't crash + assert hasattr(flux_executor, "FLUX_AVAILABLE") + except ImportError: + pytest.skip("flux_executor module not available") + + +def test_flux_executor_requires_flux_uri(): + """Test FluxExecutor raises error when FLUX_URI not set""" + try: + from libensemble.executors.flux_executor import FLUX_AVAILABLE, FluxExecutor + + if not FLUX_AVAILABLE: + pytest.skip("Flux Python bindings not available") + + # Save and clear FLUX_URI + old_uri = os.environ.get("FLUX_URI") + if "FLUX_URI" in os.environ: + del os.environ["FLUX_URI"] + + try: + from libensemble.executors.executor import ExecutorException + + with pytest.raises(ExecutorException, match="FLUX_URI"): + FluxExecutor() + finally: + if old_uri: + os.environ["FLUX_URI"] = old_uri + + except ImportError: + pytest.skip("flux_executor module not available") + + +def test_flux_task_poll_uses_get_job(): + """Test FluxTask polls using Flux's get_job helper""" + if not flux_executor.FLUX_AVAILABLE: + pytest.skip("Flux Python bindings not available") + + task = flux_executor.FluxTask( + app=SimpleNamespace(name="app"), + app_args=None, + workdir=os.getcwd(), + stdout="out.txt", + stderr="err.txt", + workerid=1, + dry_run=False, + ) + task.flux_handle = object() + task.flux_jobid = 123 + task.timer.start() + task.submit_time = task.timer.tstart + + with mock.patch.object(flux_executor.flux.job, "get_job", return_value={"state": "RUN"}) as mock_get_job: + task.poll() + + mock_get_job.assert_called_once_with(task.flux_handle, task.flux_jobid) + assert task.state == "RUNNING" + + +def test_flux_executor_submit_builds_jobspec_with_environment_and_gpus(): + """Test FluxExecutor submit passes environment and GPU resources via jobspec""" + if not flux_executor.FLUX_AVAILABLE: + pytest.skip("Flux Python bindings not available") + + executor = object.__new__(flux_executor.FluxExecutor) + executor.flux_handle = object() + executor.resources = None + executor.platform_info = {} + executor.workerID = 7 + executor.list_of_tasks = [] + executor.apps = {} + executor.default_apps = {"sim": None, "gen": None} + executor.base_dir = os.getcwd() + + app = SimpleNamespace( + name="sim", full_path="/path/to/sim.x", app_cmd="fluxwrap /path/to/sim.x", precedent="fluxwrap" + ) + executor.get_app = lambda app_name: app + executor.default_app = lambda calc_type: app + executor._check_app_exists = lambda app_obj: None + + old_env = os.environ.get("TEST_FLUX_ENV") + os.environ["TEST_FLUX_ENV"] = "present" + + jobspec = SimpleNamespace(stdout=None, stderr=None) + submit_calls = [] + + def fake_from_command(command, **kwargs): + submit_calls.append((command, kwargs)) + jobspec.cwd = kwargs.get("cwd") + jobspec.environment = kwargs.get("environment") + jobspec.setattr_shell_option = mock.Mock() + return jobspec + + try: + with ( + mock.patch.object(flux_executor.JobspecV1, "from_command", side_effect=fake_from_command), + mock.patch.object(flux_executor.flux.job, "submit", return_value=42), + ): + task = executor.submit(app_name="sim", num_procs=4, num_nodes=2, num_gpus=4, app_args="--flag value") + finally: + if old_env is None: + del os.environ["TEST_FLUX_ENV"] + else: + os.environ["TEST_FLUX_ENV"] = old_env + + command, kwargs = submit_calls[0] + assert command[:2] == ["fluxwrap", "/path/to/sim.x"] + assert command[-2:] == ["--flag", "value"] + assert kwargs["num_tasks"] == 4 + assert kwargs["num_nodes"] == 2 + assert kwargs["gpus_per_task"] == 1 + assert kwargs["environment"]["TEST_FLUX_ENV"] == "present" + assert kwargs["environment"]["LIBENSEMBLE_SIM_DIR"] == "." + jobspec.setattr_shell_option.assert_called_once_with("gpu-affinity", "per-task") + assert task.flux_jobid == 42 + + # ======================================================================================== # Test runner standalone execution # ======================================================================================== From 7103ca05668fb263347e4dfa833d69334571222d Mon Sep 17 00:00:00 2001 From: jlnav Date: Fri, 10 Jul 2026 11:57:54 -0500 Subject: [PATCH 02/10] add flux-core / flux-python to py312e and py313e environments --- pyproject.toml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e0221d927f..decf799b4e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -165,7 +165,19 @@ python = "3.14.*" [tool.pixi.feature.py312e.dependencies] globus-compute-sdk = ">=4.10.2,<5" -[tool.pixi.feature.py313e] +[tool.pixi.feature.py312e.target.linux-64.dependencies] +ax-platform = "==0.5.0" +flux-core = ">=0.81.0,<0.82" + +[tool.pixi.feature.py312e.target.linux-64.pypi-dependencies] +flux-python = ">=0.81.0, <0.82" + +[tool.pixi.feature.py313e.target.linux-64.dependencies] +ax-platform = "==0.5.0" +flux-core = ">=0.81.0,<0.82" + +[tool.pixi.feature.py313e.target.linux-64.pypi-dependencies] +flux-python = ">=0.81.0, <0.82" [tool.pixi.feature.py314e] From 66adbd1c3c574243310803af184befff895f1cf7 Mon Sep 17 00:00:00 2001 From: jlnav Date: Fri, 10 Jul 2026 13:25:10 -0500 Subject: [PATCH 03/10] additional tests/coverage attempts --- libensemble/tests/unit_tests/test_flux.py | 242 ++++++++++++++++++++++ 1 file changed, 242 insertions(+) diff --git a/libensemble/tests/unit_tests/test_flux.py b/libensemble/tests/unit_tests/test_flux.py index cc8b2a2ecf..66150a504e 100644 --- a/libensemble/tests/unit_tests/test_flux.py +++ b/libensemble/tests/unit_tests/test_flux.py @@ -17,6 +17,7 @@ import pytest from libensemble.executors import flux_executor +from libensemble.executors.executor import TimeoutExpired from libensemble.executors.mpi_runner import FLUX_MPIRunner, MPIRunner from libensemble.resources.env_resources import EnvResources from libensemble.resources.platforms import FluxAllocation, Known_platforms @@ -449,6 +450,247 @@ def fake_from_command(command, **kwargs): assert task.flux_jobid == 42 +def test_flux_executor_init_connects_with_flux_uri(): + """Test FluxExecutor initializes when Flux bindings and FLUX_URI are available.""" + fake_flux_module = SimpleNamespace(Flux=mock.Mock(return_value="flux-handle")) + + with ( + mock.patch.object(flux_executor, "FLUX_AVAILABLE", True), + mock.patch.object(flux_executor, "flux", fake_flux_module), + mock.patch.dict(os.environ, {"FLUX_URI": "local:///tmp/flux-test"}, clear=False), + ): + executor = flux_executor.FluxExecutor() + + fake_flux_module.Flux.assert_called_once_with() + assert executor.flux_handle == "flux-handle" + assert executor.resources is None + assert executor.platform_info == {} + + +def test_flux_executor_wait_on_start_polls_until_running(): + """Test FluxExecutor waits for a FluxTask to leave the startup states.""" + executor = object.__new__(flux_executor.FluxExecutor) + task = SimpleNamespace( + name="flux-task", + state="CREATED", + finished=False, + timer=SimpleNamespace(tstart=None, start=mock.Mock(side_effect=lambda: setattr(task.timer, "tstart", 1.23))), + submit_time=None, + ) + + def poll_side_effect(): + task.state = "RUNNING" + + task.poll = mock.Mock(side_effect=poll_side_effect) + + with mock.patch.object(flux_executor.time, "sleep"): + executor._wait_on_start(task, timeout=0.5) + + assert task.poll.call_count == 1 + assert task.state == "RUNNING" + assert task.timer.start.call_count == 2 + assert task.submit_time == 1.23 + + +def test_flux_task_poll_maps_completion_waiting_and_unknown_states(): + """Test FluxTask poll maps Flux job states to libEnsemble states.""" + task = flux_executor.FluxTask( + app=SimpleNamespace(name="app"), + app_args=None, + workdir=os.getcwd(), + stdout="out.txt", + stderr="err.txt", + workerid=1, + dry_run=False, + ) + task.flux_handle = object() + task.flux_jobid = 123 + task.timer.start() + task.submit_time = task.timer.tstart + fake_flux = SimpleNamespace(job=SimpleNamespace(get_job=mock.Mock())) + + with mock.patch.object(flux_executor, "flux", fake_flux): + fake_flux.job.get_job.return_value = {"state": "SCHED"} + task.poll() + assert task.state == "WAITING" + assert not task.finished + + with mock.patch.object(task, "_handle_completion") as mock_handle_completion: + fake_flux.job.get_job.return_value = {"state": "INACTIVE"} + task.poll() + mock_handle_completion.assert_called_once_with({"state": "INACTIVE"}) + + fake_flux.job.get_job.return_value = {"state": "MYSTERY"} + task.finished = False + task.poll() + + assert task.state == "UNKNOWN" + + +def test_flux_task_handle_completion_success_and_failure(): + """Test FluxTask completion handling sets success, state, and errcode.""" + success_task = flux_executor.FluxTask( + app=SimpleNamespace(name="app"), + app_args=None, + workdir=os.getcwd(), + stdout="out.txt", + stderr="err.txt", + workerid=1, + dry_run=False, + ) + success_task.timer.start() + success_task.submit_time = success_task.timer.tstart + success_task._handle_completion({"state": "INACTIVE", "result": "COMPLETED", "returncode": 0}) + assert success_task.finished is True + assert success_task.success is True + assert success_task.state == "FINISHED" + assert success_task.errcode == 0 + + failed_task = flux_executor.FluxTask( + app=SimpleNamespace(name="app"), + app_args=None, + workdir=os.getcwd(), + stdout="out.txt", + stderr="err.txt", + workerid=1, + dry_run=False, + ) + failed_task.timer.start() + failed_task.submit_time = failed_task.timer.tstart + failed_task._handle_completion({"state": "INACTIVE", "result": "FAILED", "returncode": 7}) + assert failed_task.finished is True + assert failed_task.success is False + assert failed_task.state == "FAILED" + assert failed_task.errcode == 7 + + +def test_flux_task_set_complete_handles_dry_run_and_return_codes(): + """Test FluxTask _set_complete for dry-run and non-dry-run tasks.""" + dry_run_task = flux_executor.FluxTask( + app=SimpleNamespace(name="app"), + app_args=None, + workdir=os.getcwd(), + stdout="out.txt", + stderr="err.txt", + workerid=1, + dry_run=True, + ) + dry_run_task._set_complete() + assert dry_run_task.finished is True + assert dry_run_task.success is True + assert dry_run_task.state == "FINISHED" + + finished_task = flux_executor.FluxTask( + app=SimpleNamespace(name="app"), + app_args=None, + workdir=os.getcwd(), + stdout="out.txt", + stderr="err.txt", + workerid=1, + dry_run=False, + ) + finished_task.errcode = 3 + finished_task.timer.start() + finished_task.submit_time = finished_task.timer.tstart + finished_task._set_complete() + assert finished_task.finished is True + assert finished_task.success is False + assert finished_task.state == "FAILED" + + +def test_flux_task_wait_completes_and_times_out(): + """Test FluxTask wait completes after polling and raises on timeout.""" + task = flux_executor.FluxTask( + app=SimpleNamespace(name="app"), + app_args=None, + workdir=os.getcwd(), + stdout="out.txt", + stderr="err.txt", + workerid=1, + dry_run=False, + ) + task.flux_handle = object() + task.flux_jobid = 123 + + def complete_on_second_poll(): + complete_on_second_poll.calls += 1 + if complete_on_second_poll.calls == 1: + task.state = "RUNNING" + else: + task.finished = True + task.state = "FINISHED" + + complete_on_second_poll.calls = 0 + task.poll = mock.Mock(side_effect=complete_on_second_poll) + + with mock.patch.object(flux_executor.time, "sleep"): + task.wait(timeout=1.0) + + assert task.finished is True + assert task.state == "FINISHED" + assert task.poll.call_count == 2 + + timeout_task = flux_executor.FluxTask( + app=SimpleNamespace(name="app"), + app_args=None, + workdir=os.getcwd(), + stdout="out.txt", + stderr="err.txt", + workerid=1, + dry_run=False, + ) + timeout_task.flux_handle = object() + timeout_task.flux_jobid = 456 + timeout_task.poll = mock.Mock(side_effect=lambda: setattr(timeout_task, "state", "RUNNING")) + + with ( + mock.patch.object(flux_executor.time, "sleep"), + mock.patch.object(flux_executor.time, "time", side_effect=[0.0, 0.2]), + ): + with pytest.raises(TimeoutExpired): + timeout_task.wait(timeout=0.1) + + +def test_flux_task_kill_cancels_and_marks_user_killed(): + """Test FluxTask kill cancels the job and marks the task as user-killed.""" + task = flux_executor.FluxTask( + app=SimpleNamespace(name="app"), + app_args=None, + workdir=os.getcwd(), + stdout="out.txt", + stderr="err.txt", + workerid=1, + dry_run=False, + ) + task.flux_handle = object() + task.flux_jobid = 789 + task.timer.start() + task.submit_time = task.timer.tstart + + def poll_side_effect(): + if poll_side_effect.calls == 0: + task.state = "RUNNING" + else: + task.finished = True + task.state = "FAILED" + poll_side_effect.calls += 1 + + poll_side_effect.calls = 0 + task.poll = mock.Mock(side_effect=poll_side_effect) + fake_flux = SimpleNamespace(job=SimpleNamespace(cancel=mock.Mock())) + + with ( + mock.patch.object(flux_executor, "flux", fake_flux), + mock.patch.object(flux_executor.time, "sleep"), + mock.patch.object(flux_executor.time, "time", side_effect=[0.0, 0.0, 0.2]), + ): + task.kill(wait_time=1) + + fake_flux.job.cancel.assert_called_once_with(task.flux_handle, task.flux_jobid) + assert task.state == "USER_KILLED" + assert task.finished is True + + # ======================================================================================== # Test runner standalone execution # ======================================================================================== From 41817d866153ddd8682a3ed18cc388768c65c664 Mon Sep 17 00:00:00 2001 From: jlnav Date: Tue, 26 May 2026 10:01:30 -0500 Subject: [PATCH 04/10] set gen_specs.user.lb and ub from vocs variables bounds --- libensemble/tests/unit_tests/test_ensemble.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libensemble/tests/unit_tests/test_ensemble.py b/libensemble/tests/unit_tests/test_ensemble.py index 5e5e9314f6..47ad618a13 100644 --- a/libensemble/tests/unit_tests/test_ensemble.py +++ b/libensemble/tests/unit_tests/test_ensemble.py @@ -284,7 +284,7 @@ def test_gen_specs_vocs_populates_user_bounds(): vocs = VOCS( variables={"x0": [-3, 3], "x1": [-2, 2], "x2": [-1, 1], "x3": [-1, 1]}, - objectives={"f": "EXPLORE"}, + objectives={"f": "EXPLORE"} ) gs = GenSpecs(vocs=vocs) assert "lb" in gs.user, "lb should be populated in user from VOCS" @@ -361,7 +361,11 @@ def test_gen_specs_vocs_integer_domain_yields_float_array(): from libensemble.specs import GenSpecs +<<<<<<< HEAD vocs = VOCS(variables={"x0": [0, 10], "x1": [-5, 5]}, objectives={"f": "EXPLORE"}) +======= + vocs = VOCS(variables={"x0": [0, 10], "x1": [-5, 5]}, objectives={"f": "MINIMIZE"}) +>>>>>>> 1b1cecdfd (set gen_specs.user.lb and ub from vocs variables bounds) gs = GenSpecs(vocs=vocs) assert gs.user["lb"].dtype == float, "lb should be float dtype even for integer-domain variables" assert gs.user["ub"].dtype == float, "ub should be float dtype even for integer-domain variables" From 01375408656b781c58e36535939def2694b84a71 Mon Sep 17 00:00:00 2001 From: jlnav Date: Fri, 29 May 2026 08:36:17 -0500 Subject: [PATCH 05/10] "f": "MINIMIZE" in many tests wasn't correct --- libensemble/tests/unit_tests/test_ensemble.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libensemble/tests/unit_tests/test_ensemble.py b/libensemble/tests/unit_tests/test_ensemble.py index 47ad618a13..7d3ea2d30c 100644 --- a/libensemble/tests/unit_tests/test_ensemble.py +++ b/libensemble/tests/unit_tests/test_ensemble.py @@ -361,11 +361,7 @@ def test_gen_specs_vocs_integer_domain_yields_float_array(): from libensemble.specs import GenSpecs -<<<<<<< HEAD vocs = VOCS(variables={"x0": [0, 10], "x1": [-5, 5]}, objectives={"f": "EXPLORE"}) -======= - vocs = VOCS(variables={"x0": [0, 10], "x1": [-5, 5]}, objectives={"f": "MINIMIZE"}) ->>>>>>> 1b1cecdfd (set gen_specs.user.lb and ub from vocs variables bounds) gs = GenSpecs(vocs=vocs) assert gs.user["lb"].dtype == float, "lb should be float dtype even for integer-domain variables" assert gs.user["ub"].dtype == float, "ub should be float dtype even for integer-domain variables" From d0c62312c56fe0d4dbc7dd034800f0cd61922c5d Mon Sep 17 00:00:00 2001 From: jlnav Date: Fri, 17 Jul 2026 13:18:58 -0500 Subject: [PATCH 06/10] update lockfile --- pixi.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pixi.lock b/pixi.lock index 40a1fa3a94..bed3875087 100644 --- a/pixi.lock +++ b/pixi.lock @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b8a647e974e1b7d17f2f09ecd56390632699e3c7aaff8a24a7af5d9fedda6419 -size 1087796 +oid sha256:f421728ebadb7a6e602e41cfbf8baf7e43db5762a0e788ee8267846923898035 +size 1234364 From 8d59542ccc45c5ec3ef62fe24ed499553b36442e Mon Sep 17 00:00:00 2001 From: jlnav Date: Tue, 21 Jul 2026 14:21:04 -0500 Subject: [PATCH 07/10] additional tests, plus coverage adjusts, plus remove an exception block that can't happen --- libensemble/executors/flux_executor.py | 46 +++++------------- libensemble/tests/unit_tests/test_flux.py | 59 ++++++++++++++++++++++- 2 files changed, 70 insertions(+), 35 deletions(-) diff --git a/libensemble/executors/flux_executor.py b/libensemble/executors/flux_executor.py index e2b1aa2e33..ea3163ae4e 100644 --- a/libensemble/executors/flux_executor.py +++ b/libensemble/executors/flux_executor.py @@ -166,27 +166,19 @@ def wait(self, timeout: float | None = None) -> None: if not self._check_poll(): return - try: - # Wait for job to complete - start_time = time.time() - while True: - self.poll() - if self.finished: - break - - if timeout is not None: - elapsed = time.time() - start_time - if elapsed >= timeout: - raise TimeoutExpired(self.name, timeout) - - time.sleep(0.1) - - except TimeoutExpired: - raise - except Exception as e: - logger.warning(f"Error waiting for Flux job {self.flux_jobid}: {e}") - self.state = "FAILED" - self.finished = True + # Wait for job to complete + start_time = time.time() + while True: + self.poll() + if self.finished: + break + + if timeout is not None: + elapsed = time.time() - start_time + if elapsed >= timeout: + raise TimeoutExpired(self.name, timeout) + + time.sleep(0.1) def kill(self, wait_time: int | None = 60) -> None: """Kills/cancels the Flux job. @@ -205,10 +197,6 @@ def kill(self, wait_time: int | None = 60) -> None: logger.warning(f"Trying to kill task that is no longer running. Task {self.name}: Status is {self.state}") return - if self.flux_jobid is None: - logger.warning(f"Task {self.name} has no Flux job ID - cannot kill") - return - logger.info(f"Canceling Flux job {self.flux_jobid} for task {self.name}") try: @@ -287,14 +275,6 @@ def __init__(self) -> None: self.resources = None self.platform_info: dict = {} - def set_resources(self, resources) -> None: - """Set resources for the executor.""" - self.resources = resources - - def add_platform_info(self, platform_info: dict | None = None) -> None: - """Add platform info to the executor.""" - self.platform_info = platform_info or {} - def submit( self, calc_type: str | None = None, diff --git a/libensemble/tests/unit_tests/test_flux.py b/libensemble/tests/unit_tests/test_flux.py index 66150a504e..eb0b03b0b0 100644 --- a/libensemble/tests/unit_tests/test_flux.py +++ b/libensemble/tests/unit_tests/test_flux.py @@ -398,7 +398,6 @@ def test_flux_executor_submit_builds_jobspec_with_environment_and_gpus(): executor = object.__new__(flux_executor.FluxExecutor) executor.flux_handle = object() - executor.resources = None executor.platform_info = {} executor.workerID = 7 executor.list_of_tasks = [] @@ -463,7 +462,6 @@ def test_flux_executor_init_connects_with_flux_uri(): fake_flux_module.Flux.assert_called_once_with() assert executor.flux_handle == "flux-handle" - assert executor.resources is None assert executor.platform_info == {} @@ -597,6 +595,52 @@ def test_flux_task_set_complete_handles_dry_run_and_return_codes(): assert finished_task.success is False assert finished_task.state == "FAILED" + # cover waiting on a task that completes before timeout + task = flux_executor.FluxTask( + app=SimpleNamespace(name="app"), + app_args=None, + workdir=os.getcwd(), + stdout="out.txt", + stderr="err.txt", + workerid=1, + dry_run=False, + ) + task._set_complete() + task.flux_jobid = 123 + task.wait(timeout=10) + task.kill() + + +def test_flux_task_dry_run_exception_and_kill(): + """Test FluxTask dry run exception attributes.""" + task = flux_executor.FluxTask( + app=SimpleNamespace(name="app"), + app_args=None, + workdir=os.getcwd(), + stdout="out.txt", + stderr="err.txt", + workerid=1, + dry_run=True, + ) + task.wait() + assert task.finished is True + assert task.success is True + assert task.state == "FINISHED" + task.kill() + task = flux_executor.FluxTask( + app=SimpleNamespace(name="app"), + app_args=None, + workdir=os.getcwd(), + stdout="out.txt", + stderr="err.txt", + workerid=1, + dry_run=True, + ) + task.poll() + assert task.finished is True + assert task.success is True + assert task.state == "FINISHED" + def test_flux_task_wait_completes_and_times_out(): """Test FluxTask wait completes after polling and raises on timeout.""" @@ -716,6 +760,7 @@ def poll_side_effect(): # Validator tests test_validator_accepts_flux() test_validator_accepts_all_runners() + test_validator_rejects_invalid() # Platform tests test_flux_allocation_platform() @@ -724,4 +769,14 @@ def poll_side_effect(): # EnvResources tests test_env_resources_flux_env_variable() + # Flux Executor tests + test_flux_executor_init_connects_with_flux_uri() + test_flux_executor_wait_on_start_polls_until_running() + test_flux_task_poll_maps_completion_waiting_and_unknown_states() + test_flux_task_handle_completion_success_and_failure() + test_flux_task_set_complete_handles_dry_run_and_return_codes() + test_flux_task_dry_run_exception_and_kill() + test_flux_task_wait_completes_and_times_out() + test_flux_task_kill_cancels_and_marks_user_killed() + print("All standalone tests passed!") From a1fcf17c079577cc80304c751c009a0e7b1d803a Mon Sep 17 00:00:00 2001 From: jlnav Date: Wed, 22 Jul 2026 12:40:47 -0500 Subject: [PATCH 08/10] vibe-coded coverage for FluxExecutor.submit --- libensemble/tests/unit_tests/test_flux.py | 252 +++++++++++++++++++++- 1 file changed, 244 insertions(+), 8 deletions(-) diff --git a/libensemble/tests/unit_tests/test_flux.py b/libensemble/tests/unit_tests/test_flux.py index eb0b03b0b0..cbfc673923 100644 --- a/libensemble/tests/unit_tests/test_flux.py +++ b/libensemble/tests/unit_tests/test_flux.py @@ -391,19 +391,22 @@ def test_flux_task_poll_uses_get_job(): assert task.state == "RUNNING" -def test_flux_executor_submit_builds_jobspec_with_environment_and_gpus(): - """Test FluxExecutor submit passes environment and GPU resources via jobspec""" - if not flux_executor.FLUX_AVAILABLE: - pytest.skip("Flux Python bindings not available") - +def _make_uninitialized_flux_executor(*, worker_id: int = 7): executor = object.__new__(flux_executor.FluxExecutor) executor.flux_handle = object() executor.platform_info = {} - executor.workerID = 7 + executor.workerID = worker_id executor.list_of_tasks = [] executor.apps = {} executor.default_apps = {"sim": None, "gen": None} executor.base_dir = os.getcwd() + return executor + + +def test_flux_executor_submit_builds_jobspec_with_environment_and_gpus(): + """Test FluxExecutor submit passes environment and GPU resources via jobspec""" + + executor = _make_uninitialized_flux_executor(worker_id=7) app = SimpleNamespace( name="sim", full_path="/path/to/sim.x", app_cmd="fluxwrap /path/to/sim.x", precedent="fluxwrap" @@ -427,9 +430,12 @@ def fake_from_command(command, **kwargs): try: with ( - mock.patch.object(flux_executor.JobspecV1, "from_command", side_effect=fake_from_command), + mock.patch.object(flux_executor, "JobspecV1", create=True, autospec=False) as _patched_jobspecV1, + mock.patch.object(flux_executor, "flux", create=True) as _patched_flux, # noqa: F841 # noqa: F841 + mock.patch.object(flux_executor.flux, "job", create=True) as _patched_job, # noqa: F841 mock.patch.object(flux_executor.flux.job, "submit", return_value=42), ): + _patched_jobspecV1.from_command.side_effect = fake_from_command task = executor.submit(app_name="sim", num_procs=4, num_nodes=2, num_gpus=4, app_args="--flag value") finally: if old_env is None: @@ -444,11 +450,241 @@ def fake_from_command(command, **kwargs): assert kwargs["num_nodes"] == 2 assert kwargs["gpus_per_task"] == 1 assert kwargs["environment"]["TEST_FLUX_ENV"] == "present" - assert kwargs["environment"]["LIBENSEMBLE_SIM_DIR"] == "." + # Environment passed through to Jobspec should include current process env. + assert "LIBENSEMBLE_SIM_DIR" not in kwargs["environment"] or isinstance( + kwargs["environment"].get("LIBENSEMBLE_SIM_DIR"), str + ) jobspec.setattr_shell_option.assert_called_once_with("gpu-affinity", "per-task") assert task.flux_jobid == 42 +def test_flux_executor_submit_dry_run_marks_task_complete_and_does_not_submit_job(): + """Dry-run should not call JobspecV1.from_command or flux.job.submit.""" + executor = _make_uninitialized_flux_executor(worker_id=7) + + app = SimpleNamespace( + name="sim", + full_path="/path/to/sim.x", + app_cmd="fluxwrap /path/to/sim.x", + precedent="fluxwrap", + ) + + executor.get_app = lambda app_name: app + executor.default_app = lambda calc_type: app + executor._check_app_exists = mock.Mock() + + mock_from_command = mock.Mock() + + with ( + mock.patch.object(flux_executor, "JobspecV1", create=True, autospec=False) as _patched_jobspecV1, + mock.patch.object(flux_executor, "flux", create=True) as _patched_flux, # noqa: F841 + mock.patch.object(flux_executor.flux, "job", create=True) as _patched_job, # noqa: F841 + mock.patch.object(flux_executor.flux.job, "submit") as mock_submit, + ): + _patched_jobspecV1.from_command = mock_from_command + task = executor.submit( + app_name="sim", + num_procs=2, + num_nodes=1, + num_gpus=0, + app_args="--flag", + stdout="out.txt", + stderr="err.txt", + dry_run=True, + ) + + mock_from_command.assert_not_called() + mock_submit.assert_not_called() + executor._check_app_exists.assert_not_called() + assert task.finished is True + assert task.state == "FINISHED" + assert task.success is True + assert task.runline is not None + assert len(executor.list_of_tasks) == 1 + + +def test_flux_executor_submit_wait_on_start_invokes_waiter(): + """wait_on_start should call FluxExecutor._wait_on_start when not in dry_run.""" + executor = _make_uninitialized_flux_executor(worker_id=7) + + app = SimpleNamespace( + name="sim", + full_path="/path/to/sim.x", + app_cmd="fluxwrap /path/to/sim.x", + precedent="fluxwrap", + ) + + executor.get_app = lambda app_name: app + executor.default_app = lambda calc_type: app + executor._check_app_exists = lambda app_obj: None + + jobspec = SimpleNamespace(stdout=None, stderr=None) + + with ( + mock.patch.object(flux_executor, "JobspecV1", create=True, autospec=False) as _patched_jobspecV1, + mock.patch.object(flux_executor, "flux", create=True) as _patched_flux, # noqa: F841 + mock.patch.object(flux_executor.flux, "job", create=True) as _patched_job, # noqa: F841 + mock.patch.object(flux_executor.flux.job, "submit", return_value=123), + mock.patch.object(executor, "_wait_on_start") as mock_wait_on_start, + ): + _patched_jobspecV1.from_command.return_value = jobspec + task = executor.submit( + app_name="sim", + num_procs=2, + num_nodes=1, + num_gpus=None, + wait_on_start=True, + ) + + mock_wait_on_start.assert_called_once_with(task) + assert task.flux_jobid == 123 + + +def test_flux_executor_submit_validation_errors(): + executor = _make_uninitialized_flux_executor(worker_id=7) + + app = SimpleNamespace( + name="sim", + full_path="/path/to/sim.x", + app_cmd="fluxwrap /path/to/sim.x", + precedent="fluxwrap", + ) + + executor.get_app = lambda app_name: app + executor.default_app = lambda calc_type: app + executor._check_app_exists = lambda app_obj: None + + # Missing app_name + calc_type + with pytest.raises(Exception): + executor.submit() + + # extra_args unsupported + with pytest.raises(Exception, match="extra_args"): + executor.submit(app_name="sim", num_procs=1, num_nodes=1, extra_args="--x") + + # num_gpus negative + with pytest.raises(Exception, match="num_gpus must be non-negative"): + executor.submit(app_name="sim", num_procs=2, num_nodes=1, num_gpus=-1) + + # num_gpus not divisible by num_procs + with pytest.raises(Exception, match="num_gpus must be divisible by num_procs"): + executor.submit(app_name="sim", num_procs=3, num_nodes=1, num_gpus=2) + + # procs_per_node divides num_procs -> num_nodes inferred + with ( + mock.patch.object(flux_executor, "JobspecV1", create=True, autospec=False) as _patched_jobspecV1, + mock.patch.object(flux_executor, "flux", create=True) as _patched_flux, # noqa: F841 + mock.patch.object(flux_executor.flux, "job", create=True) as _patched_job, # noqa: F841 + mock.patch.object(flux_executor.flux.job, "submit", return_value=1), + ): + _patched_jobspecV1.from_command.return_value = SimpleNamespace(stdout=None, stderr=None) + executor.submit(app_name="sim", num_procs=4, procs_per_node=2) + + # num_procs must be divisible by procs_per_node + with pytest.raises(Exception, match="divisible by procs_per_node"): + executor.submit(app_name="sim", num_procs=3, procs_per_node=2) + + # num_procs must equal num_nodes * procs_per_node + with pytest.raises(Exception, match=r"num_procs must equal num_nodes \* procs_per_node"): + executor.submit(app_name="sim", num_procs=5, num_nodes=2, procs_per_node=3) + + +def test_flux_executor_submit_error_from_flux_job_submit_sets_failed_to_start(): + executor = _make_uninitialized_flux_executor(worker_id=7) + + app = SimpleNamespace( + name="sim", + full_path="/path/to/sim.x", + app_cmd="fluxwrap /path/to/sim.x", + precedent="fluxwrap", + ) + + executor.get_app = lambda app_name: app + executor.default_app = lambda calc_type: app + executor._check_app_exists = lambda app_obj: None + + jobspec = SimpleNamespace(stdout=None, stderr=None) + + with ( + mock.patch.object(flux_executor, "JobspecV1", create=True, autospec=False) as _patched_jobspecV1, + mock.patch.object(flux_executor, "flux", create=True) as _patched_flux, # noqa: F841 + mock.patch.object(flux_executor.flux, "job", create=True) as _patched_job, # noqa: F841 + mock.patch.object(flux_executor.flux.job, "submit", side_effect=RuntimeError("boom")), + ): + _patched_jobspecV1.from_command.return_value = jobspec + with pytest.raises(Exception, match="Failed to submit Flux job"): + executor.submit(app_name="sim", num_procs=2, num_nodes=1) + + # Submit failed; the task is created, but it may or may not be appended + # depending on where the exception is raised. Ensure the exception type is correct. + assert executor.list_of_tasks == [] + + +def test_flux_executor_submit_stdout_stderr_are_placed_under_workdir(): + executor = _make_uninitialized_flux_executor(worker_id=7) + + app = SimpleNamespace( + name="sim", + full_path="/path/to/sim.x", + app_cmd="fluxwrap /path/to/sim.x", + precedent="fluxwrap", + ) + + executor.get_app = lambda app_name: app + executor.default_app = lambda calc_type: app + executor._check_app_exists = lambda app_obj: None + + jobspec = SimpleNamespace(stdout=None, stderr=None) + + with ( + mock.patch.object(flux_executor, "JobspecV1", create=True, autospec=False) as _patched_jobspecV1, + mock.patch.object(flux_executor, "flux", create=True) as _patched_flux, # noqa: F841 + mock.patch.object(flux_executor.flux, "job", create=True) as _patched_job, # noqa: F841 + mock.patch.object(flux_executor.flux.job, "submit", return_value=1), + ): + _patched_jobspecV1.from_command.return_value = jobspec + task = executor.submit( + app_name="sim", + num_procs=2, + num_nodes=1, + stdout="my_stdout.txt", + stderr="my_stderr.txt", + ) + + assert task.flux_jobid == 1 + assert jobspec.stdout.endswith(os.path.join(task.workdir, "my_stdout.txt")) + assert jobspec.stderr.endswith(os.path.join(task.workdir, "my_stderr.txt")) + + +def test_flux_executor_submit_sets_gpu_affinity_only_when_num_gpus_nonzero(): + executor = _make_uninitialized_flux_executor(worker_id=7) + + app = SimpleNamespace( + name="sim", + full_path="/path/to/sim.x", + app_cmd="fluxwrap /path/to/sim.x", + precedent="fluxwrap", + ) + + executor.get_app = lambda app_name: app + executor.default_app = lambda calc_type: app + executor._check_app_exists = lambda app_obj: None + + jobspec = SimpleNamespace(stdout=None, stderr=None) + jobspec.setattr_shell_option = mock.Mock() + + with ( + mock.patch.object(flux_executor, "JobspecV1", create=True, autospec=False) as _patched_jobspecV1, + mock.patch.object(flux_executor, "flux", create=True) as _patched_flux, # noqa: F841 + mock.patch.object(flux_executor.flux, "job", create=True) as _patched_job, # noqa: F841 + mock.patch.object(flux_executor.flux.job, "submit", return_value=1), + ): + _patched_jobspecV1.from_command.return_value = jobspec + executor.submit(app_name="sim", num_procs=4, num_nodes=1, num_gpus=0) + + jobspec.setattr_shell_option.assert_not_called() + + def test_flux_executor_init_connects_with_flux_uri(): """Test FluxExecutor initializes when Flux bindings and FLUX_URI are available.""" fake_flux_module = SimpleNamespace(Flux=mock.Mock(return_value="flux-handle")) From 5efe3703687ab6e11f004c71de0105478846e9fc Mon Sep 17 00:00:00 2001 From: jlnav Date: Thu, 23 Jul 2026 10:35:32 -0500 Subject: [PATCH 09/10] FluxExecutor appends/respects existing environment. safeguards and messages about FluxExecutor's internal FluxState not being thread-safe, so process-based only. set more expected attributes upon Flux results. use Flux's submit_async instead for non-blocking. don't wait too long to kill a flux job. Specify flux uri optionally to FluxExecutor init in case the instance isn't obvious. passthrough task.stdout and task.stderr to JobSpecV1. test adjustments --- libensemble/executors/flux_executor.py | 156 +++++++++++++--------- libensemble/tests/unit_tests/test_flux.py | 122 ++++++++++------- 2 files changed, 172 insertions(+), 106 deletions(-) diff --git a/libensemble/executors/flux_executor.py b/libensemble/executors/flux_executor.py index ea3163ae4e..8185c9ae8d 100644 --- a/libensemble/executors/flux_executor.py +++ b/libensemble/executors/flux_executor.py @@ -19,7 +19,13 @@ Requirements: - flux-core Python bindings must be installed - - Must be running inside a Flux instance (FLUX_URI must be set) + - Must be running inside a Flux instance or provide a Flux URI + +Notes: + Flux handles are not thread-safe. FluxExecutor is best suited for + process-based libEnsemble runs, such as multiprocessing or MPI workers. + The executor reconnects lazily after process serialization so each worker + process uses its own Flux handle. """ import logging @@ -127,19 +133,29 @@ def _handle_completion(self, info: dict) -> None: self.finished = True self.calc_task_timing() - # Check result/exit status result = str(info.get("result", "")).upper() - success = result == "COMPLETED" or info.get("returncode", 1) == 0 + self.errcode = info.get("returncode", 1) + self.success = result == "COMPLETED" or self.errcode == 0 + self.state = "FINISHED" if self.success else "FAILED" + if self.success: + self.errcode = 0 - if success: - self.success = True - self.state = "FINISHED" + logger.info(f"Task {self.name} finished with state {self.state} (result={result})") + + def _handle_result(self, info) -> None: + """Handle a terminal Flux JobInfo object returned by flux.job.result().""" + result = str(getattr(info, "result", "")).upper() + returncode = getattr(info, "returncode", 1) + if returncode == "": + returncode = 0 if result == "COMPLETED" else 1 + + self.errcode = returncode + self.finished = True + self.calc_task_timing() + self.success = result == "COMPLETED" or self.errcode == 0 + self.state = "FINISHED" if self.success else "FAILED" + if self.success: self.errcode = 0 - else: - self.success = False - self.state = "FAILED" - # Try to get exit code from result - self.errcode = info.get("returncode", 1) logger.info(f"Task {self.name} finished with state {self.state} (result={result})") @@ -166,19 +182,26 @@ def wait(self, timeout: float | None = None) -> None: if not self._check_poll(): return - # Wait for job to complete - start_time = time.time() - while True: - self.poll() - if self.finished: - break + if timeout is not None: + start_time = time.time() + while True: + self.poll() + if self.finished: + return - if timeout is not None: - elapsed = time.time() - start_time - if elapsed >= timeout: + if time.time() - start_time >= timeout: raise TimeoutExpired(self.name, timeout) - time.sleep(0.1) + time.sleep(0.1) + + try: + info = flux.job.result(self.flux_handle, self.flux_jobid) + self._handle_result(info) + except Exception as e: + logger.warning(f"Error waiting for Flux job {self.flux_jobid}: {e}") + self.state = "UNKNOWN" + self.runtime = self.timer.elapsed + raise def kill(self, wait_time: int | None = 60) -> None: """Kills/cancels the Flux job. @@ -200,23 +223,22 @@ def kill(self, wait_time: int | None = 60) -> None: logger.info(f"Canceling Flux job {self.flux_jobid} for task {self.name}") try: - # Cancel the job using Flux API flux.job.cancel(self.flux_handle, self.flux_jobid) - - # Wait briefly for cancellation to take effect - if wait_time: - deadline = time.time() + min(wait_time, 5) # Don't wait too long - while time.time() < deadline: - self.poll() - if self.finished: - break - time.sleep(0.1) - except Exception as e: logger.warning(f"Error canceling Flux job {self.flux_jobid}: {e}") + return + + if wait_time: + deadline = time.time() + min(wait_time, 5) # Don't wait too long + while time.time() < deadline: + self.poll() + if self.finished: + break + time.sleep(0.1) self.state = "USER_KILLED" self.finished = True + self.success = False self.calc_task_timing() @@ -230,12 +252,14 @@ class FluxExecutor(Executor): Parameters ---------- - None + uri: str, Optional + Flux instance URI. If omitted, ``flux.Flux()`` connects to the nearest + enclosing Flux instance discovered by Flux. Raises ------ ExecutorException - If flux Python bindings are not available or FLUX_URI is not set. + If flux Python bindings are not available or connecting to Flux fails. Example ------- @@ -251,7 +275,7 @@ class FluxExecutor(Executor): task.wait() """ - def __init__(self) -> None: + def __init__(self, uri: str | None = None) -> None: """Instantiate a new FluxExecutor instance.""" if not FLUX_AVAILABLE: raise ExecutorException( @@ -259,21 +283,27 @@ def __init__(self) -> None: "Install flux-core or use MPIExecutor with mpi_runner='flux' instead." ) - if not os.environ.get("FLUX_URI"): - raise ExecutorException( - "FLUX_URI environment variable not set. " "FluxExecutor must be used inside a Flux instance." - ) - super().__init__() - # Connect to the Flux instance - try: - self.flux_handle = flux.Flux() - except Exception as e: - raise ExecutorException(f"Failed to connect to Flux instance: {e}") - self.resources = None self.platform_info: dict = {} + self.uri = uri + self.flux_handle = None + + def __getstate__(self): + """Avoid sharing non-thread-safe Flux handles across worker processes.""" + state = self.__dict__.copy() + state["flux_handle"] = None + return state + + def _get_flux_handle(self): + """Return a Flux handle for this process, opening it lazily if needed.""" + if self.flux_handle is None: + try: + self.flux_handle = flux.Flux(self.uri) if self.uri is not None else flux.Flux() + except Exception as e: + raise ExecutorException(f"Failed to connect to Flux instance: {e}") + return self.flux_handle def submit( self, @@ -287,7 +317,7 @@ def submit( stdout: str | None = None, stderr: str | None = None, dry_run: bool = False, - wait_on_start: bool = False, + wait_on_start: bool | int = False, extra_args: str | None = None, ) -> FluxTask: """Submit a job to Flux. @@ -326,8 +356,9 @@ def submit( dry_run: bool, Optional If True, don't actually submit the job - wait_on_start: bool, Optional - Whether to wait for job to start running + wait_on_start: bool or int, Optional + Whether to wait for job to start running. If an integer N is supplied, + wait at most N seconds. extra_args: str, Optional Additional arguments (currently not used for native Flux) @@ -349,7 +380,8 @@ def submit( default_workdir = os.getcwd() task = FluxTask(app, app_args, default_workdir, stdout, stderr, self.workerID, dry_run) - task.flux_handle = self.flux_handle + if not dry_run: + task.flux_handle = self._get_flux_handle() if not dry_run: self._check_app_exists(task.app) @@ -363,8 +395,6 @@ def submit( if num_procs % procs_per_node != 0: raise ExecutorException("num_procs must be divisible by procs_per_node for FluxExecutor") num_nodes = num_procs // procs_per_node - else: - num_nodes = 1 elif procs_per_node is not None and num_procs != num_nodes * procs_per_node: raise ExecutorException("num_procs must equal num_nodes * procs_per_node for FluxExecutor") @@ -390,6 +420,9 @@ def submit( raise ExecutorException("num_gpus must be divisible by num_procs for FluxExecutor") gpus_per_task = num_gpus // num_procs if num_gpus else 0 + environment = dict(os.environ) + environment.update(task.env) + jobspec = JobspecV1.from_command( command, num_tasks=num_procs, @@ -397,25 +430,28 @@ def submit( cores_per_task=1, gpus_per_task=gpus_per_task, cwd=task.workdir, - environment=dict(os.environ), + environment=environment, + output=os.path.join(task.workdir, task.stdout), + error=os.path.join(task.workdir, task.stderr), ) - - if stdout: - jobspec.stdout = os.path.join(task.workdir, stdout) - if stderr: - jobspec.stderr = os.path.join(task.workdir, stderr) if gpus_per_task: jobspec.setattr_shell_option("gpu-affinity", "per-task") logger.info(f"Submitting Flux job for task {task.name}: {task.runline}") - task.flux_jobid = flux.job.submit(self.flux_handle, jobspec) + task.flux_future = flux.job.submit_async(task.flux_handle, jobspec) + task.flux_jobid = task.flux_future.get_id() if task.flux_future else None logger.info(f"Task {task.name} submitted with Flux job ID {task.flux_jobid}") task.timer.start() task.submit_time = task.timer.tstart if wait_on_start: - self._wait_on_start(task) + timeout = ( + wait_on_start + if isinstance(wait_on_start, int) and not isinstance(wait_on_start, bool) + else 60.0 + ) + self._wait_on_start(task, timeout) except Exception as e: logger.error(f"Failed to submit Flux job: {e}") diff --git a/libensemble/tests/unit_tests/test_flux.py b/libensemble/tests/unit_tests/test_flux.py index cbfc673923..9d624c5b30 100644 --- a/libensemble/tests/unit_tests/test_flux.py +++ b/libensemble/tests/unit_tests/test_flux.py @@ -339,27 +339,24 @@ def test_flux_executor_import_without_flux(): pytest.skip("flux_executor module not available") -def test_flux_executor_requires_flux_uri(): - """Test FluxExecutor raises error when FLUX_URI not set""" +def test_flux_executor_connects_lazily_with_default_or_explicit_uri(): + """FluxExecutor should defer Flux connection and support explicit URIs.""" try: from libensemble.executors.flux_executor import FLUX_AVAILABLE, FluxExecutor if not FLUX_AVAILABLE: pytest.skip("Flux Python bindings not available") - # Save and clear FLUX_URI - old_uri = os.environ.get("FLUX_URI") - if "FLUX_URI" in os.environ: - del os.environ["FLUX_URI"] - - try: - from libensemble.executors.executor import ExecutorException + with mock.patch.object(flux_executor.flux, "Flux", return_value="default-handle") as mock_flux: + executor = FluxExecutor() + assert executor.flux_handle is None + assert executor._get_flux_handle() == "default-handle" + mock_flux.assert_called_once_with() - with pytest.raises(ExecutorException, match="FLUX_URI"): - FluxExecutor() - finally: - if old_uri: - os.environ["FLUX_URI"] = old_uri + with mock.patch.object(flux_executor.flux, "Flux", return_value="uri-handle") as mock_flux: + executor = FluxExecutor(uri="local:///tmp/flux-uri") + assert executor._get_flux_handle() == "uri-handle" + mock_flux.assert_called_once_with("local:///tmp/flux-uri") except ImportError: pytest.skip("flux_executor module not available") @@ -395,6 +392,7 @@ def _make_uninitialized_flux_executor(*, worker_id: int = 7): executor = object.__new__(flux_executor.FluxExecutor) executor.flux_handle = object() executor.platform_info = {} + executor.uri = None executor.workerID = worker_id executor.list_of_tasks = [] executor.apps = {} @@ -420,6 +418,7 @@ def test_flux_executor_submit_builds_jobspec_with_environment_and_gpus(): jobspec = SimpleNamespace(stdout=None, stderr=None) submit_calls = [] + submit_future = SimpleNamespace(get_id=mock.Mock(return_value=42)) def fake_from_command(command, **kwargs): submit_calls.append((command, kwargs)) @@ -431,9 +430,9 @@ def fake_from_command(command, **kwargs): try: with ( mock.patch.object(flux_executor, "JobspecV1", create=True, autospec=False) as _patched_jobspecV1, - mock.patch.object(flux_executor, "flux", create=True) as _patched_flux, # noqa: F841 # noqa: F841 + mock.patch.object(flux_executor, "flux", create=True) as _patched_flux, # noqa: F841 mock.patch.object(flux_executor.flux, "job", create=True) as _patched_job, # noqa: F841 - mock.patch.object(flux_executor.flux.job, "submit", return_value=42), + mock.patch.object(flux_executor.flux.job, "submit_async", return_value=submit_future) as mock_submit_async, ): _patched_jobspecV1.from_command.side_effect = fake_from_command task = executor.submit(app_name="sim", num_procs=4, num_nodes=2, num_gpus=4, app_args="--flag value") @@ -450,16 +449,18 @@ def fake_from_command(command, **kwargs): assert kwargs["num_nodes"] == 2 assert kwargs["gpus_per_task"] == 1 assert kwargs["environment"]["TEST_FLUX_ENV"] == "present" - # Environment passed through to Jobspec should include current process env. - assert "LIBENSEMBLE_SIM_DIR" not in kwargs["environment"] or isinstance( - kwargs["environment"].get("LIBENSEMBLE_SIM_DIR"), str - ) + assert kwargs["environment"]["LIBENSEMBLE_SIM_DIR"] == "." + assert kwargs["output"] == os.path.join(task.workdir, task.stdout) + assert kwargs["error"] == os.path.join(task.workdir, task.stderr) + mock_submit_async.assert_called_once_with(executor.flux_handle, jobspec) + submit_future.get_id.assert_called_once_with() jobspec.setattr_shell_option.assert_called_once_with("gpu-affinity", "per-task") assert task.flux_jobid == 42 + assert task.flux_future is submit_future def test_flux_executor_submit_dry_run_marks_task_complete_and_does_not_submit_job(): - """Dry-run should not call JobspecV1.from_command or flux.job.submit.""" + """Dry-run should not call JobspecV1.from_command or flux.job.submit_async.""" executor = _make_uninitialized_flux_executor(worker_id=7) app = SimpleNamespace( @@ -479,7 +480,7 @@ def test_flux_executor_submit_dry_run_marks_task_complete_and_does_not_submit_jo mock.patch.object(flux_executor, "JobspecV1", create=True, autospec=False) as _patched_jobspecV1, mock.patch.object(flux_executor, "flux", create=True) as _patched_flux, # noqa: F841 mock.patch.object(flux_executor.flux, "job", create=True) as _patched_job, # noqa: F841 - mock.patch.object(flux_executor.flux.job, "submit") as mock_submit, + mock.patch.object(flux_executor.flux.job, "submit_async") as mock_submit, ): _patched_jobspecV1.from_command = mock_from_command task = executor.submit( @@ -519,12 +520,13 @@ def test_flux_executor_submit_wait_on_start_invokes_waiter(): executor._check_app_exists = lambda app_obj: None jobspec = SimpleNamespace(stdout=None, stderr=None) + submit_future = SimpleNamespace(get_id=mock.Mock(return_value=123)) with ( mock.patch.object(flux_executor, "JobspecV1", create=True, autospec=False) as _patched_jobspecV1, mock.patch.object(flux_executor, "flux", create=True) as _patched_flux, # noqa: F841 mock.patch.object(flux_executor.flux, "job", create=True) as _patched_job, # noqa: F841 - mock.patch.object(flux_executor.flux.job, "submit", return_value=123), + mock.patch.object(flux_executor.flux.job, "submit_async", return_value=submit_future), mock.patch.object(executor, "_wait_on_start") as mock_wait_on_start, ): _patched_jobspecV1.from_command.return_value = jobspec @@ -533,10 +535,10 @@ def test_flux_executor_submit_wait_on_start_invokes_waiter(): num_procs=2, num_nodes=1, num_gpus=None, - wait_on_start=True, + wait_on_start=7, ) - mock_wait_on_start.assert_called_once_with(task) + mock_wait_on_start.assert_called_once_with(task, 7) assert task.flux_jobid == 123 @@ -575,7 +577,9 @@ def test_flux_executor_submit_validation_errors(): mock.patch.object(flux_executor, "JobspecV1", create=True, autospec=False) as _patched_jobspecV1, mock.patch.object(flux_executor, "flux", create=True) as _patched_flux, # noqa: F841 mock.patch.object(flux_executor.flux, "job", create=True) as _patched_job, # noqa: F841 - mock.patch.object(flux_executor.flux.job, "submit", return_value=1), + mock.patch.object( + flux_executor.flux.job, "submit_async", return_value=SimpleNamespace(get_id=mock.Mock(return_value=1)) + ), ): _patched_jobspecV1.from_command.return_value = SimpleNamespace(stdout=None, stderr=None) executor.submit(app_name="sim", num_procs=4, procs_per_node=2) @@ -609,7 +613,7 @@ def test_flux_executor_submit_error_from_flux_job_submit_sets_failed_to_start(): mock.patch.object(flux_executor, "JobspecV1", create=True, autospec=False) as _patched_jobspecV1, mock.patch.object(flux_executor, "flux", create=True) as _patched_flux, # noqa: F841 mock.patch.object(flux_executor.flux, "job", create=True) as _patched_job, # noqa: F841 - mock.patch.object(flux_executor.flux.job, "submit", side_effect=RuntimeError("boom")), + mock.patch.object(flux_executor.flux.job, "submit_async", side_effect=RuntimeError("boom")), ): _patched_jobspecV1.from_command.return_value = jobspec with pytest.raises(Exception, match="Failed to submit Flux job"): @@ -634,15 +638,21 @@ def test_flux_executor_submit_stdout_stderr_are_placed_under_workdir(): executor.default_app = lambda calc_type: app executor._check_app_exists = lambda app_obj: None - jobspec = SimpleNamespace(stdout=None, stderr=None) + submit_calls = [] + + def fake_from_command(command, **kwargs): + submit_calls.append(kwargs) + return SimpleNamespace(stdout=None, stderr=None) with ( mock.patch.object(flux_executor, "JobspecV1", create=True, autospec=False) as _patched_jobspecV1, mock.patch.object(flux_executor, "flux", create=True) as _patched_flux, # noqa: F841 mock.patch.object(flux_executor.flux, "job", create=True) as _patched_job, # noqa: F841 - mock.patch.object(flux_executor.flux.job, "submit", return_value=1), + mock.patch.object( + flux_executor.flux.job, "submit_async", return_value=SimpleNamespace(get_id=mock.Mock(return_value=1)) + ), ): - _patched_jobspecV1.from_command.return_value = jobspec + _patched_jobspecV1.from_command.side_effect = fake_from_command task = executor.submit( app_name="sim", num_procs=2, @@ -652,8 +662,8 @@ def test_flux_executor_submit_stdout_stderr_are_placed_under_workdir(): ) assert task.flux_jobid == 1 - assert jobspec.stdout.endswith(os.path.join(task.workdir, "my_stdout.txt")) - assert jobspec.stderr.endswith(os.path.join(task.workdir, "my_stderr.txt")) + assert submit_calls[0]["output"].endswith(os.path.join(task.workdir, "my_stdout.txt")) + assert submit_calls[0]["error"].endswith(os.path.join(task.workdir, "my_stderr.txt")) def test_flux_executor_submit_sets_gpu_affinity_only_when_num_gpus_nonzero(): @@ -677,7 +687,9 @@ def test_flux_executor_submit_sets_gpu_affinity_only_when_num_gpus_nonzero(): mock.patch.object(flux_executor, "JobspecV1", create=True, autospec=False) as _patched_jobspecV1, mock.patch.object(flux_executor, "flux", create=True) as _patched_flux, # noqa: F841 mock.patch.object(flux_executor.flux, "job", create=True) as _patched_job, # noqa: F841 - mock.patch.object(flux_executor.flux.job, "submit", return_value=1), + mock.patch.object( + flux_executor.flux.job, "submit_async", return_value=SimpleNamespace(get_id=mock.Mock(return_value=1)) + ), ): _patched_jobspecV1.from_command.return_value = jobspec executor.submit(app_name="sim", num_procs=4, num_nodes=1, num_gpus=0) @@ -685,20 +697,15 @@ def test_flux_executor_submit_sets_gpu_affinity_only_when_num_gpus_nonzero(): jobspec.setattr_shell_option.assert_not_called() -def test_flux_executor_init_connects_with_flux_uri(): - """Test FluxExecutor initializes when Flux bindings and FLUX_URI are available.""" - fake_flux_module = SimpleNamespace(Flux=mock.Mock(return_value="flux-handle")) - - with ( - mock.patch.object(flux_executor, "FLUX_AVAILABLE", True), - mock.patch.object(flux_executor, "flux", fake_flux_module), - mock.patch.dict(os.environ, {"FLUX_URI": "local:///tmp/flux-test"}, clear=False), - ): - executor = flux_executor.FluxExecutor() +def test_flux_executor_getstate_drops_flux_handle(): + """FluxExecutor should not serialize an open Flux handle into worker processes.""" + with mock.patch.object(flux_executor, "FLUX_AVAILABLE", True): + executor = flux_executor.FluxExecutor(uri="local:///tmp/flux-test") - fake_flux_module.Flux.assert_called_once_with() + executor.flux_handle = "flux-handle" + state = executor.__getstate__() + assert state["flux_handle"] is None assert executor.flux_handle == "flux-handle" - assert executor.platform_info == {} def test_flux_executor_wait_on_start_polls_until_running(): @@ -910,6 +917,29 @@ def complete_on_second_poll(): assert task.state == "FINISHED" assert task.poll.call_count == 2 + result_task = flux_executor.FluxTask( + app=SimpleNamespace(name="app"), + app_args=None, + workdir=os.getcwd(), + stdout="out.txt", + stderr="err.txt", + workerid=1, + dry_run=False, + ) + result_task.flux_handle = object() + result_task.flux_jobid = 321 + result_task.timer.start() + result_task.submit_time = result_task.timer.tstart + result_info = SimpleNamespace(result="COMPLETED", returncode=0) + fake_flux = SimpleNamespace(job=SimpleNamespace(result=mock.Mock(return_value=result_info))) + + with mock.patch.object(flux_executor, "flux", fake_flux): + result_task.wait() + + fake_flux.job.result.assert_called_once_with(result_task.flux_handle, result_task.flux_jobid) + assert result_task.finished is True + assert result_task.state == "FINISHED" + timeout_task = flux_executor.FluxTask( app=SimpleNamespace(name="app"), app_args=None, @@ -1006,7 +1036,7 @@ def poll_side_effect(): test_env_resources_flux_env_variable() # Flux Executor tests - test_flux_executor_init_connects_with_flux_uri() + test_flux_executor_getstate_drops_flux_handle() test_flux_executor_wait_on_start_polls_until_running() test_flux_task_poll_maps_completion_waiting_and_unknown_states() test_flux_task_handle_completion_success_and_failure() From 04ec032bd8e07ac3aa4204c7600a86687fb54544 Mon Sep 17 00:00:00 2001 From: jlnav Date: Tue, 8 Sep 2026 15:51:14 -0500 Subject: [PATCH 10/10] resolve/remove old ax-platform pin --- pixi.lock | 4 ++-- pyproject.toml | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pixi.lock b/pixi.lock index bed3875087..71990c9d04 100644 --- a/pixi.lock +++ b/pixi.lock @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f421728ebadb7a6e602e41cfbf8baf7e43db5762a0e788ee8267846923898035 -size 1234364 +oid sha256:94625240a210e869d7239f4709c9db1312145c6d53e876b0a25d70e7e8d87ead +size 1248106 diff --git a/pyproject.toml b/pyproject.toml index decf799b4e..fa82ba28d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -166,14 +166,12 @@ python = "3.14.*" globus-compute-sdk = ">=4.10.2,<5" [tool.pixi.feature.py312e.target.linux-64.dependencies] -ax-platform = "==0.5.0" flux-core = ">=0.81.0,<0.82" [tool.pixi.feature.py312e.target.linux-64.pypi-dependencies] flux-python = ">=0.81.0, <0.82" [tool.pixi.feature.py313e.target.linux-64.dependencies] -ax-platform = "==0.5.0" flux-core = ">=0.81.0,<0.82" [tool.pixi.feature.py313e.target.linux-64.pypi-dependencies]