Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some typing #6622

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/_ert_job_runner/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ def ensure_file_handles_closed():
f"Most likely you are missing and should add "
f"'#!/usr/bin/env python' to the top of the file: "
)
stderr.write(msg)
if stderr is not None:
stderr.write(msg)
ensure_file_handles_closed()
yield Exited(self, e.errno).with_error(msg)
return
Expand Down
4 changes: 2 additions & 2 deletions src/ert/job_queue/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

if TYPE_CHECKING:
from ert.config import QueueConfig
from ert.job_queue import QueueableRealization, RealizationState

Check failure on line 11 in src/ert/job_queue/driver.py

View workflow job for this annotation

GitHub Actions / check-style (3.11)

[*] `ert.job_queue.QueueableRealization` imported but unused


class Driver(ABC):
Expand All @@ -32,15 +32,15 @@
return option_key in self._options

@abstractmethod
async def submit(self, realization: "QueueableRealization"):
async def submit(self, realization: "RealizationState"):
pass

@abstractmethod
async def poll_statuses(self):
pass

@abstractmethod
async def kill(self, realization: "QueueableRealization"):
async def kill(self, realization: "RealizationState"):
pass

@classmethod
Expand Down
8 changes: 5 additions & 3 deletions src/ert/job_queue/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import logging
import ssl
from collections import deque
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union

from cloudevents.conversion import to_json
Expand Down Expand Up @@ -159,10 +160,11 @@ def kill_all_jobs(self) -> None:
def queue_size(self) -> int:
return len(self._realizations)

def _add_realization(self, realization: QueueableRealization) -> None:
def _add_realization(self, realization: QueueableRealization) -> int:
self._realizations.append(
RealizationState(self, realization, retries=self._queue_config.max_submit - 1)
)
return len(self._realizations) - 1

def max_running(self) -> int:
max_running = 0
Expand Down Expand Up @@ -360,7 +362,7 @@ def add_realization_from_run_arg(
num_cpu: int,
) -> None:
qreal = QueueableRealization(
job_script=job_script,
job_script=Path(job_script),
run_arg=run_arg,
num_cpu=num_cpu,
max_runtime=max_runtime,
Expand All @@ -374,7 +376,7 @@ def add_realization(
callback_timeout: Optional[Callable[[int], None]] = None,
) -> None:
qreal = QueueableRealization(
job_script=real.job_script,
job_script=Path(real.job_script),
num_cpu=real.num_cpu,
run_arg=real.run_arg,
max_runtime=real.max_runtime,
Expand Down
Loading