Skip to content

Commit

Permalink
global: upgrade black formatter version
Browse files Browse the repository at this point in the history
  • Loading branch information
reana-team authored and tiborsimko committed Mar 31, 2022
1 parent 2e539ec commit 18ddca4
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is part of REANA.
# Copyright (C) 2020 CERN.
# Copyright (C) 2020, 2022 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand Down Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Check Python code formatting
run: |
pip install --upgrade pip
pip install black==19.10b0
pip install black
./run-tests.sh --check-black
lint-flake8:
Expand Down
5 changes: 4 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@
"page": "_static/api",
"spec": "openapi.json",
"embed": True,
"opts": {"hide-loading": True, "hide-hostname": True,},
"opts": {
"hide-loading": True,
"hide-hostname": True,
},
}
]

Expand Down
3 changes: 2 additions & 1 deletion reana_workflow_controller/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ def on_message(self, body, message):
workflow = (
Session.query(Workflow)
.filter(
Workflow.id_ == workflow_uuid, Workflow.status.in_(ALIVE_STATUSES),
Workflow.id_ == workflow_uuid,
Workflow.status.in_(ALIVE_STATUSES),
)
.one_or_none()
)
Expand Down
13 changes: 10 additions & 3 deletions reana_workflow_controller/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def __init__(self, deployment_name, workspace, image, port, path, cvmfs_repos=No
self.path = path
self.cvmfs_repos = cvmfs_repos or []
metadata = client.V1ObjectMeta(
name=deployment_name, labels={"reana_workflow_mode": "session"},
name=deployment_name,
labels={"reana_workflow_mode": "session"},
)
self.kubernetes_objects = {
"ingress": self._build_ingress(metadata),
Expand Down Expand Up @@ -114,7 +115,10 @@ def _build_service(self, metadata):
selector={"app": self.deployment_name},
)
service = client.V1APIService(
api_version="v1", kind="Service", spec=spec, metadata=metadata,
api_version="v1",
kind="Service",
spec=spec,
metadata=metadata,
)
return service

Expand All @@ -139,7 +143,10 @@ def _build_deployment(self, metadata):
template=template,
)
deployment = client.V1Deployment(
api_version="apps/v1", kind="Deployment", metadata=metadata, spec=spec,
api_version="apps/v1",
kind="Deployment",
metadata=metadata,
spec=spec,
)

return deployment
Expand Down
11 changes: 8 additions & 3 deletions reana_workflow_controller/rest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,10 @@ def create_workflow_workspace(
gitlab_access_token, REANA_GITLAB_HOST, git_url
)
repo = Repo.clone_from(
url=url, to_path=os.path.abspath(path), branch=git_branch, depth=1,
url=url,
to_path=os.path.abspath(path),
branch=git_branch,
depth=1,
)
repo.head.reset(commit=git_ref)

Expand Down Expand Up @@ -623,10 +626,12 @@ def get_workspace_diff(workflow_a, workflow_b, brief=False, context_lines=5):
diff_result = subprocess.run(diff_command, stdout=subprocess.PIPE)
diff_result_string = diff_result.stdout.decode("utf-8")
diff_result_string = diff_result_string.replace(
workspace_a, get_workflow_name(workflow_a),
workspace_a,
get_workflow_name(workflow_a),
)
diff_result_string = diff_result_string.replace(
workspace_b, get_workflow_name(workflow_b),
workspace_b,
get_workflow_name(workflow_b),
)

return diff_result_string
Expand Down
3 changes: 2 additions & 1 deletion reana_workflow_controller/workflow_run_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,8 @@ def _create_job_controller_startup_cmd(self, user=None):
WORKFLOW_RUNTIME_USER_UID, WORKFLOW_RUNTIME_USER_GID, user
)
chown_workspace_cmd = "chown -R {} {};".format(
WORKFLOW_RUNTIME_USER_UID, self.workflow.workspace_path,
WORKFLOW_RUNTIME_USER_UID,
self.workflow.workspace_path,
)
run_app_cmd = 'su {} /bin/bash -c "{}"'.format(user, base_cmd)
full_cmd = add_group_cmd + add_user_cmd + chown_workspace_cmd + run_app_cmd
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ pyrsistent==0.18.1 # via jsonschema
python-dateutil==2.8.2 # via bravado, bravado-core, kubernetes
pytz==2021.3 # via bravado-core, fs
pyyaml==5.4.1 # via bravado, bravado-core, kubernetes, reana-commons, swagger-spec-validator
reana-commons[kubernetes]==0.9.0a5 # via reana-db, reana-workflow-controller (setup.py)
reana-db==0.9.0a4 # via reana-workflow-controller (setup.py)
reana-commons[kubernetes]==0.9.0a6 # via reana-db, reana-workflow-controller (setup.py)
reana-db==0.9.0a5 # via reana-workflow-controller (setup.py)
requests-oauthlib==1.3.1 # via kubernetes
requests==2.25.0 # via bravado, kubernetes, reana-workflow-controller (setup.py), requests-oauthlib
rfc3987==1.3.8 # via jsonschema
Expand Down
16 changes: 11 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@
history = open("CHANGES.rst").read()

tests_require = [
"pytest-reana>=0.9.0a1,<0.10.0",
"pytest-reana>=0.9.0a4,<0.10.0",
]

extras_require = {
"debug": ["wdb", "ipdb", "Flask-DebugToolbar",],
"debug": [
"wdb",
"ipdb",
"Flask-DebugToolbar",
],
"docs": [
"Sphinx>=1.4.4",
"sphinx-rtd-theme>=0.1.9",
Expand Down Expand Up @@ -53,8 +57,8 @@
"jsonpickle>=0.9.6",
"marshmallow>2.13.0,<=2.20.1",
"packaging>=18.0",
"reana-commons[kubernetes]>=0.9.0a5,<0.10.0",
"reana-db>=0.9.0a4,<0.10.0",
"reana-commons[kubernetes]>=0.9.0a6,<0.10.0",
"reana-db>=0.9.0a5,<0.10.0",
"requests==2.25.0",
"sqlalchemy-utils>=0.31.0",
"uwsgi-tools>=1.1.1",
Expand All @@ -80,7 +84,9 @@
author="REANA",
author_email="[email protected]",
url="https://github.com/reanahub/reana-workflow-controller",
packages=["reana_workflow_controller",],
packages=[
"reana_workflow_controller",
],
include_package_data=True,
zip_safe=False,
entry_points={
Expand Down
7 changes: 5 additions & 2 deletions tests/test_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@


def test_workflow_finish_and_kubernetes_not_available(
in_memory_queue_connection, sample_serial_workflow_in_db, consume_queue,
in_memory_queue_connection,
sample_serial_workflow_in_db,
consume_queue,
):
"""Test workflow finish with a Kubernetes connection troubles."""
sample_serial_workflow_in_db.status = RunStatus.running
Expand All @@ -30,7 +32,8 @@ def test_workflow_finish_and_kubernetes_not_available(
connection=in_memory_queue_connection, queue=job_status_consumer.queue
)
workflow_status_publisher.publish_workflow_status(
str(sample_serial_workflow_in_db.id_), next_status.value,
str(sample_serial_workflow_in_db.id_),
next_status.value,
)
k8s_corev1_api_client_mock = Mock()
k8s_corev1_api_client_mock.delete_namespaced_job = Mock(
Expand Down
6 changes: 5 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ def test_delete_all_workflow_runs(

@pytest.mark.parametrize("workspace", [True, False])
def test_workspace_deletion(
app, session, default_user, sample_yadage_workflow_in_db, workspace,
app,
session,
default_user,
sample_yadage_workflow_in_db,
workspace,
):
"""Test workspace deletion."""
workflow = sample_yadage_workflow_in_db
Expand Down
9 changes: 7 additions & 2 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1346,7 +1346,10 @@ def test_get_workspace_diff(
csv_line = "1,2,3,4"
file_name = "test.csv"
for index, workspace in enumerate([workspace_path_a, workspace_path_b]):
with open(os.path.join(workspace, file_name), "w",) as f:
with open(
os.path.join(workspace, file_name),
"w",
) as f:
f.write("# File {}".format(index))
f.write(os.linesep)
f.write(csv_line)
Expand Down Expand Up @@ -1444,7 +1447,9 @@ def test_close_interactive_session(
path = "/5d9b30fd-f225-4615-9107-b1373afec070"
name = "interactive-jupyter-5d9b30fd-f225-4615-9107-b1373afec070-5lswkp"
int_session = InteractiveSession(
name=name, path=path, owner_id=sample_serial_workflow_in_db.owner_id,
name=name,
path=path,
owner_id=sample_serial_workflow_in_db.owner_id,
)
sample_serial_workflow_in_db.sessions.append(int_session)
session.add(sample_serial_workflow_in_db)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_workflow_run_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ def test_interactive_session_closure(sample_serial_workflow_in_db, session):
kwrm.start_interactive_session(InteractiveSessionType(0).name)

int_session = InteractiveSession.query.filter_by(
owner_id=workflow.owner_id, type_=InteractiveSessionType(0).name,
owner_id=workflow.owner_id,
type_=InteractiveSessionType(0).name,
).first()
assert int_session.status == RunStatus.created
kwrm.stop_interactive_session(int_session.id_)
Expand Down

0 comments on commit 18ddca4

Please sign in to comment.