Skip to content
Open
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
6 changes: 3 additions & 3 deletions .github/workflows/validate_release_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ def get_version_from_module(content: str) -> str:
parser = argparse.ArgumentParser()
parser.add_argument("GITHUB_REF", help="The GITHUB_REF environmental variable")
args = parser.parse_args()
assert args.GITHUB_REF.startswith(
"refs/tags/v"
), f'GITHUB_REF should start with "refs/tags/v": {args.GITHUB_REF}'
assert args.GITHUB_REF.startswith("refs/tags/v"), (
f'GITHUB_REF should start with "refs/tags/v": {args.GITHUB_REF}'
)
tag_version = args.GITHUB_REF[11:]
package_version = get_version_from_module(
Path("aiida_hyperqueue/__init__.py").read_text(encoding="utf-8")
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ default_language_version:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- id: check-json

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
rev: v0.16.1
hooks:
- id: ruff-format
- id: ruff
Expand Down
5 changes: 2 additions & 3 deletions aiida_hyperqueue/cli/alloc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import click

from aiida.cmdline.params import arguments, options
from aiida.cmdline.utils import echo

Expand Down Expand Up @@ -59,8 +58,8 @@ def cmd_add(

with computer.get_transport() as transport:
retval, _, stderr = transport.exec_command_wait(
f'hq alloc add slurm --backlog {backlog} --time-limit {time_limit} --name ahq {hyper} '
f'--workers-per-alloc {workers_per_alloc} -- {" ".join(slurm_options)}'
f"hq alloc add slurm --backlog {backlog} --time-limit {time_limit} --name ahq {hyper} "
f"--workers-per-alloc {workers_per_alloc} -- {' '.join(slurm_options)}"
)

if retval != 0:
Expand Down
4 changes: 1 addition & 3 deletions aiida_hyperqueue/cli/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import click
import requests

from aiida import orm
from aiida.cmdline.utils import echo

Expand Down Expand Up @@ -66,8 +65,7 @@ def cmd_install(
tar_path = temp_dir / "hq.tar.gz"

with open(tar_path, "wb") as f:
for chunk in response.iter_content(chunk_size=8192):
f.write(chunk)
f.writelines(response.iter_content(chunk_size=8192))

with tarfile.open(tar_path, "r") as tar:
tar.extractall(path=temp_dir)
Expand Down
1 change: 0 additions & 1 deletion aiida_hyperqueue/cli/params/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import functools

import click

from aiida.cmdline.params import options as core_options
from aiida.cmdline.params import types as core_types

Expand Down
1 change: 0 additions & 1 deletion aiida_hyperqueue/cli/root.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""

import click

from aiida.cmdline.groups.verdi import VerdiCommandGroup

from .params import options
Expand Down
1 change: 0 additions & 1 deletion aiida_hyperqueue/cli/server.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import click

from aiida.cmdline.utils import echo

from .params import arguments
Expand Down
4 changes: 2 additions & 2 deletions aiida_hyperqueue/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def _parse_submit_output(self, retval: int, stdout: str, stderr: str) -> str:
)

def _get_joblist_command(
self, jobs: t.Optional[list] = None, user: t.Optional[str] = None
self, jobs: list | None = None, user: str | None = None
) -> str:
"""Return the ``hq`` command for listing the active jobs.

Expand Down Expand Up @@ -255,7 +255,7 @@ def _parse_joblist_output(self, retval: int, stdout: str, stderr: str) -> list:
hq_job_dict["id"]
) # must be str, if it is a int job will not waiting
job_info.title = hq_job_dict["name"]
stats: t.List[str] = [
stats: list[str] = [
stat for stat, v in hq_job_dict["task_stats"].items() if v > 0
]
if hq_job_dict["task_count"] != 1 or len(stats) != 1:
Expand Down
8 changes: 3 additions & 5 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@

import time

import aiida_hyperqueue

from aiida import load_profile
from aiida.storage.sqlite_temp import SqliteTempBackend

import aiida_hyperqueue

# -- AiiDA-related setup --------------------------------------------------
temp_profile = SqliteTempBackend.create_profile("temp-profile")
load_profile(temp_profile, allow_switch=True)
Expand Down Expand Up @@ -71,9 +71,7 @@
else f"{copyright_first_year}-{current_year}"
)
# pylint: disable=redefined-builtin
copyright = "{}, {}. All rights reserved".format(
copyright_year_string, copyright_owners
)
copyright = f"{copyright_year_string}, {copyright_owners}. All rights reserved"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down
6 changes: 2 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import signal
import subprocess
import time
from collections.abc import Iterable
from dataclasses import dataclass
from pathlib import Path
from collections.abc import Iterable

import pytest

Expand Down Expand Up @@ -103,9 +103,7 @@ def check_running_processes(self):
for p in self.processes:
if p.final_check and p.process.poll() is not None:
raise Exception(
"Process {0} crashed (log in {1}/{0}.out)".format(
p.name, self.work_path
)
f"Process {p.name} crashed (log in {self.work_path}/{p.name}.out)"
)

def kill_all(self):
Expand Down
3 changes: 1 addition & 2 deletions tests/test_cli_alloc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import pytest
from click.testing import CliRunner

from aiida.transports.transport import Transport as TransportClass
from click.testing import CliRunner


@pytest.fixture
Expand Down
3 changes: 2 additions & 1 deletion tests/test_cli_install.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import pytest
from aiida_hyperqueue.cli import cmd_install
from click.testing import CliRunner

from aiida_hyperqueue.cli import cmd_install


@pytest.fixture
def runner():
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli_server.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import time

import pytest
from aiida_hyperqueue.cli import cmd_info, cmd_start, cmd_stop
from aiida.transports.transport import Transport as TransportClass
from click.testing import CliRunner

from aiida.transports.transport import Transport as TransportClass
from aiida_hyperqueue.cli import cmd_info, cmd_start, cmd_stop

from .conftest import HqEnv, get_hq_binary

Expand Down
4 changes: 2 additions & 2 deletions tests/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
from pathlib import Path

import pytest
from aiida_hyperqueue.scheduler import HyperQueueJobResource, HyperQueueScheduler

from aiida.common.datastructures import CodeRunMode
from aiida.schedulers import JobState
from aiida.schedulers.datastructures import JobTemplate, JobTemplateCodeInfo

from aiida_hyperqueue.scheduler import HyperQueueJobResource, HyperQueueScheduler

from .conftest import HqEnv
from .utils import wait_for_job_state

Expand Down
Loading