slurmray 3.6.0__py3-none-any.whl → 3.6.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of slurmray might be problematic. Click here for more details.
- slurmray/RayLauncher.py +13 -11
- slurmray/assets/slurmray_server_template.py +1 -1
- {slurmray-3.6.0.dist-info → slurmray-3.6.1.dist-info}/METADATA +1 -1
- slurmray-3.6.1.dist-info/RECORD +10 -0
- slurmray-3.6.0.dist-info/RECORD +0 -10
- {slurmray-3.6.0.dist-info → slurmray-3.6.1.dist-info}/LICENSE +0 -0
- {slurmray-3.6.0.dist-info → slurmray-3.6.1.dist-info}/WHEEL +0 -0
slurmray/RayLauncher.py
CHANGED
|
@@ -87,17 +87,19 @@ class RayLauncher:
|
|
|
87
87
|
self.__write_python_script()
|
|
88
88
|
self.script_file, self.job_name = self.__write_slurm_script()
|
|
89
89
|
|
|
90
|
-
def __call__(self, cancel_old_jobs: bool = True) -> Any:
|
|
90
|
+
def __call__(self, cancel_old_jobs: bool = True, serialize: bool = True) -> Any:
|
|
91
91
|
"""Launch the job and return the result
|
|
92
92
|
|
|
93
93
|
Args:
|
|
94
94
|
cancel_old_jobs (bool, optional): Cancel the old jobs. Defaults to True.
|
|
95
|
+
serialize (bool, optional): Serialize the function and the arguments. This should be set to False if the function is automatically called by the server. Defaults to True.
|
|
95
96
|
|
|
96
97
|
Returns:
|
|
97
98
|
Any: Result of the function
|
|
98
99
|
"""
|
|
99
100
|
# Sereialize function and arguments
|
|
100
|
-
|
|
101
|
+
if serialize:
|
|
102
|
+
self.__serialize_func_and_args(self.func, self.args)
|
|
101
103
|
|
|
102
104
|
if self.cluster:
|
|
103
105
|
print("Cluster detected, running on cluster...")
|
|
@@ -168,13 +170,6 @@ class RayLauncher:
|
|
|
168
170
|
"""
|
|
169
171
|
print("Serializing function and arguments...")
|
|
170
172
|
|
|
171
|
-
# Check if there is already a func.pkl and args.pkl file
|
|
172
|
-
if os.path.exists(
|
|
173
|
-
os.path.join(self.project_path, "func.pkl")
|
|
174
|
-
) and os.path.exists(os.path.join(self.project_path, "args.pkl")):
|
|
175
|
-
print("Function and arguments already serialized.")
|
|
176
|
-
return
|
|
177
|
-
|
|
178
173
|
# Pickle the function
|
|
179
174
|
with open(os.path.join(self.project_path, "func.pkl"), "wb") as f:
|
|
180
175
|
dill.dump(func, f)
|
|
@@ -312,6 +307,7 @@ class RayLauncher:
|
|
|
312
307
|
subprocess.Popen(
|
|
313
308
|
["tail", "-f", os.path.join(self.project_path, "{}.log".format(job_name))]
|
|
314
309
|
)
|
|
310
|
+
start_time = time.time()
|
|
315
311
|
while True:
|
|
316
312
|
time.sleep(0.25)
|
|
317
313
|
if os.path.exists(
|
|
@@ -361,6 +357,12 @@ class RayLauncher:
|
|
|
361
357
|
node_list,
|
|
362
358
|
)
|
|
363
359
|
)[1:]
|
|
360
|
+
|
|
361
|
+
# Update the queue log
|
|
362
|
+
if time.time() - start_time > 60:
|
|
363
|
+
start_time = time.time()
|
|
364
|
+
print("Update time: {}".format(time.strftime("%H:%M:%S")))
|
|
365
|
+
|
|
364
366
|
if current_queue is None or current_queue != to_queue:
|
|
365
367
|
current_queue = to_queue
|
|
366
368
|
with open(queue_log_file, "w") as f:
|
|
@@ -559,13 +561,13 @@ if __name__ == "__main__":
|
|
|
559
561
|
launcher = RayLauncher(
|
|
560
562
|
project_name="example", # Name of the project (will create a directory with this name in the current directory)
|
|
561
563
|
func=example_func, # Function to execute
|
|
562
|
-
args={"x":
|
|
564
|
+
args={"x": 5}, # Arguments of the function
|
|
563
565
|
files=[
|
|
564
566
|
"slurmray/RayLauncher.py"
|
|
565
567
|
], # List of files to push to the cluster (file path will be recreated on the cluster)
|
|
566
568
|
modules=[], # List of modules to load on the curnagl Cluster (CUDA & CUDNN are automatically added if use_gpu=True)
|
|
567
569
|
node_nbr=1, # Number of nodes to use
|
|
568
|
-
use_gpu=
|
|
570
|
+
use_gpu=True, # If you need A100 GPU, you can set it to True
|
|
569
571
|
memory=8, # In MegaBytes
|
|
570
572
|
max_running_time=5, # In minutes
|
|
571
573
|
runtime_env={
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
slurmray/RayLauncher.py,sha256=KfmlTBqfv3KFe1Kyk1n6lEZwJfLnZKQxKKpKlRNAre8,23452
|
|
2
|
+
slurmray/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
slurmray/assets/sbatch_template.sh,sha256=c-7J4ItzrctDrbF5Znu8p1d_xIgayC9puhjX3nLMzsk,2273
|
|
4
|
+
slurmray/assets/slurmray_server.sh,sha256=-PpX3AitLVfAYjyNqE3BjtDu5uvk11KoiaCUVgmtcEQ,1506
|
|
5
|
+
slurmray/assets/slurmray_server_template.py,sha256=JwX2pH7K9pb10JuRxe3EsjSUp1t3xm0ojEh8H2W2lVo,461
|
|
6
|
+
slurmray/assets/spython_template.py,sha256=kRUvNQs9iCcg0wJLmm9LV0TnbUdlenZMYPr_bZPkXLg,597
|
|
7
|
+
slurmray-3.6.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
8
|
+
slurmray-3.6.1.dist-info/METADATA,sha256=kqs_CKzsLCACuKE67WdILR7LosGAtTRe-xDez-Trozk,3530
|
|
9
|
+
slurmray-3.6.1.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
|
10
|
+
slurmray-3.6.1.dist-info/RECORD,,
|
slurmray-3.6.0.dist-info/RECORD
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
slurmray/RayLauncher.py,sha256=3pOOMGDENspcfHiEaxWoyLx6Wep5XHItRBuSXJ3cUvI,23279
|
|
2
|
-
slurmray/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
slurmray/assets/sbatch_template.sh,sha256=c-7J4ItzrctDrbF5Znu8p1d_xIgayC9puhjX3nLMzsk,2273
|
|
4
|
-
slurmray/assets/slurmray_server.sh,sha256=-PpX3AitLVfAYjyNqE3BjtDu5uvk11KoiaCUVgmtcEQ,1506
|
|
5
|
-
slurmray/assets/slurmray_server_template.py,sha256=PF4Rl3TrTS8hI0jbCMlOuRmICkL_OucO6R-uKq83kvg,446
|
|
6
|
-
slurmray/assets/spython_template.py,sha256=kRUvNQs9iCcg0wJLmm9LV0TnbUdlenZMYPr_bZPkXLg,597
|
|
7
|
-
slurmray-3.6.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
8
|
-
slurmray-3.6.0.dist-info/METADATA,sha256=VrDOXUE4gBXscmducVlQ2pqzEl2kV0kRO9pBKO-gWQM,3530
|
|
9
|
-
slurmray-3.6.0.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
|
10
|
-
slurmray-3.6.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|