Skip to content

Commit 665c011

Browse files
committed
black reformatting of jobs files
Signed-off-by: Kevin <[email protected]>
1 parent dccad02 commit 665c011

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/codeflare_sdk/jobs/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from dataclasses import dataclass, field
2222
from typing import Optional, Dict
2323

24+
2425
@dataclass
2526
class JobConfiguration:
2627
"""

src/codeflare_sdk/jobs/jobs.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@
3030
from .config import JobConfiguration
3131

3232
import typing
33+
3334
if typing.TYPE_CHECKING:
3435
from ..cluster.cluster import Cluster
3536

3637
all_jobs: List["Job"] = []
3738
torchx_runner: Runner = get_runner()
3839

40+
3941
class JobDefinition(metaclass=abc.ABCMeta):
4042
"""
4143
A job definition to be submitted to a generic backend cluster.
@@ -54,6 +56,7 @@ def submit(self, cluster: "Cluster"):
5456
"""
5557
pass
5658

59+
5760
class Job(metaclass=abc.ABCMeta):
5861
"""
5962
An abstract class that defines the necessary methods for authenticating to a remote environment.
@@ -91,13 +94,13 @@ def _dry_run(self, cluster: "Cluster", *script_args) -> AppDryRunInfo:
9194
return torchx_runner.dryrun(
9295
app=ddp(
9396
*script_args,
94-
script = self.config.script,
97+
script=self.config.script,
9598
m=self.config.m,
9699
name=self.config.name,
97100
h=None, # for custom resource types
98101
cpu=cluster.config.max_cpus,
99-
gpu = cluster.config.gpu,
100-
memMB = 1024 * cluster.config.max_memory, # cluster memory is in GB
102+
gpu=cluster.config.gpu,
103+
memMB=1024 * cluster.config.max_memory, # cluster memory is in GB
101104
j=j,
102105
env=self.config.env,
103106
# max_retries=0, # default
@@ -110,7 +113,7 @@ def _dry_run(self, cluster: "Cluster", *script_args) -> AppDryRunInfo:
110113
"working_dir": self.config.working_dir,
111114
"requirements": self.config.requirements,
112115
},
113-
workspace=f"file://{Path.cwd()}"
116+
workspace=f"file://{Path.cwd()}",
114117
)
115118

116119
def submit(self, cluster: "Cluster") -> "TorchXRayJob":
@@ -124,13 +127,18 @@ class TorchXRayJob(Job):
124127
"""
125128
Active submission of a dist.ddp job to a Ray cluster which can be used to get logs and status.
126129
"""
127-
def __init__(self, job_definition: TorchXJobDefinition, cluster: "Cluster", *script_args):
130+
131+
def __init__(
132+
self, job_definition: TorchXJobDefinition, cluster: "Cluster", *script_args
133+
):
128134
"""
129135
Creates job which maximizes resource usage on the passed cluster.
130136
"""
131137
self.job_definition: TorchXJobDefinition = job_definition
132138
self.cluster: "Cluster" = cluster
133-
self._app_handle = torchx_runner.schedule(job_definition._dry_run(cluster, *script_args))
139+
self._app_handle = torchx_runner.schedule(
140+
job_definition._dry_run(cluster, *script_args)
141+
)
134142
all_jobs.append(self)
135143

136144
@property

0 commit comments

Comments
 (0)