Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 13, 2025
1 parent d65b7ad commit 01f425b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
6 changes: 3 additions & 3 deletions dpdispatcher/contexts/ssh_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,9 @@ def __init__(
self.init_local_root = local_root
self.init_remote_root = remote_root
self.temp_local_root = os.path.abspath(local_root)
assert os.path.isabs(
os.path.realpath(remote_root)
), "remote_root must be a abspath"
assert os.path.isabs(os.path.realpath(remote_root)), (
"remote_root must be a abspath"
)
self.temp_remote_root = remote_root
self.remote_profile = remote_profile
self.remote_root = None
Expand Down
2 changes: 1 addition & 1 deletion dpdispatcher/machines/JH_UniScheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def gen_script_header(self, job):
custom_gpu_line = resources.kwargs.get("custom_gpu_line", None)
if not custom_gpu_line:
script_header_dict["JH_UniScheduler_number_gpu_line"] = (
"" f"#JSUB -gpgpu {resources.gpu_per_node}"
f"#JSUB -gpgpu {resources.gpu_per_node}"
)
else:
script_header_dict["JH_UniScheduler_number_gpu_line"] = custom_gpu_line
Expand Down
3 changes: 1 addition & 2 deletions dpdispatcher/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,7 @@ async def async_run_submission(self, **kwargs):
kwargs = {**{"clean": False}, **kwargs}
if kwargs["clean"]:
dlog.warning(
"Using async submission with `clean=True`, "
"job may fail in queue system"
"Using async submission with `clean=True`, job may fail in queue system"
)
loop = asyncio.get_event_loop()
wrapped_submission = functools.partial(self.run_submission, **kwargs)
Expand Down
17 changes: 6 additions & 11 deletions dpdispatcher/utils/hdfs_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def exists(uri):
)
except Exception as e:
raise RuntimeError(
f"Cannot check existence of hdfs uri[{uri}] " f"with cmd[{cmd}]"
f"Cannot check existence of hdfs uri[{uri}] with cmd[{cmd}]"
) from e

@staticmethod
Expand All @@ -48,9 +48,7 @@ def remove(uri):
f"with cmd[{cmd}]; ret[{ret}] output[{out}] stderr[{err}]"
)
except Exception as e:
raise RuntimeError(
f"Cannot remove hdfs uri[{uri}] " f"with cmd[{cmd}]"
) from e
raise RuntimeError(f"Cannot remove hdfs uri[{uri}] with cmd[{cmd}]") from e

Check warning on line 51 in dpdispatcher/utils/hdfs_cli.py

View check run for this annotation

Codecov / codecov/patch

dpdispatcher/utils/hdfs_cli.py#L51

Added line #L51 was not covered by tests

@staticmethod
def mkdir(uri):
Expand All @@ -70,7 +68,7 @@ def mkdir(uri):
)
except Exception as e:
raise RuntimeError(
f"Cannot mkdir of hdfs uri[{uri}] " f"with cmd[{cmd}]"
f"Cannot mkdir of hdfs uri[{uri}] with cmd[{cmd}]"
) from e

@staticmethod
Expand All @@ -80,7 +78,7 @@ def copy_from_local(local_path, to_uri):
"""
# Make sure local_path is accessible
if not os.path.exists(local_path) or not os.access(local_path, os.R_OK):
raise RuntimeError(f"try to access local_path[{local_path}] " "but failed")
raise RuntimeError(f"try to access local_path[{local_path}] but failed")

Check warning on line 81 in dpdispatcher/utils/hdfs_cli.py

View check run for this annotation

Codecov / codecov/patch

dpdispatcher/utils/hdfs_cli.py#L81

Added line #L81 was not covered by tests
cmd = f"hadoop fs -copyFromLocal -f {local_path} {to_uri}"
try:
ret, out, err = run_cmd_with_all_output(cmd)
Expand Down Expand Up @@ -132,9 +130,7 @@ def read_hdfs_file(uri):
f"cmd [{cmd}] ret[{ret}] output[{out}] stderr[{err}]"
)
except Exception as e:
raise RuntimeError(
f"Cannot read text from uri[{uri}]" f"cmd [{cmd}]"
) from e
raise RuntimeError(f"Cannot read text from uri[{uri}]cmd [{cmd}]") from e

Check warning on line 133 in dpdispatcher/utils/hdfs_cli.py

View check run for this annotation

Codecov / codecov/patch

dpdispatcher/utils/hdfs_cli.py#L133

Added line #L133 was not covered by tests

@staticmethod
def move(from_uri, to_uri):
Expand All @@ -151,6 +147,5 @@ def move(from_uri, to_uri):
)
except Exception as e:
raise RuntimeError(
f"Cannot move from_uri[{from_uri}] to "
f"to_uri[{to_uri}] with cmd[{cmd}]"
f"Cannot move from_uri[{from_uri}] to to_uri[{to_uri}] with cmd[{cmd}]"
) from e

0 comments on commit 01f425b

Please sign in to comment.