Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Svdvoort/slurmpie
Browse files Browse the repository at this point in the history
  • Loading branch information
svdvoort committed Jul 13, 2023
2 parents 3da0c01 + 68f224e commit b04ab88
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion slurmpie/slurmpie.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os
import re
import subprocess
from typing import Dict, Tuple, Union
from typing import Dict, Tuple, Union, List


class Job:
Expand All @@ -25,6 +25,7 @@ def __init__(
memory_size: Union[str, int] = "",
name: str = "",
nodes: int = -1,
nodelist: str = "",
output_file: str = "",
partition: str = "",
tasks: int = -1,
Expand Down Expand Up @@ -55,6 +56,7 @@ def __init__(
See :func:`slurmpie.slurmpie.Job.memory_size` for the specification.
name (str, optional): The name of the job.
nodes (int, optional): Number of nodes to use for the job.
nodelist (str, optional): Request specific host nodes for job.
output_file (str, optional): File path for the slurm output file.
partition (str, optional): Name of the partition to which to submit the job.
tasks (int, optional): Number of tasks.
Expand All @@ -75,6 +77,7 @@ def __init__(
self._memory_size = ""
self._memory_units = None
self._id = next(Job._newid)
self._nodelist = ""

self.script = script
self.script_is_file = script_is_file
Expand Down Expand Up @@ -298,6 +301,23 @@ def array(self, array_spec: Union[list, str]):

self._array = self._format_argument_list(self._array, array_spec)

@property
def nodelist(self) -> str:
"""
List of nodes to run the job on.
When you want to run a job on a specific node (that is not specified by a queue),
you can use this argument to specify the exact nodes you want to run
the job on.
"""

return self._nodelist

@nodelist.setter
def nodelist(self, nodelist_spec: str):
self._nodelist = nodelist_spec


@property
def gpus(self) -> str:
"""
Expand Down Expand Up @@ -361,6 +381,7 @@ def _format_sbatch_command(self) -> list:
"tasks": "ntasks",
"time": "time",
"workdir": "chdir",
"nodelist": "nodelist"
}

# We set parsable to easily get job id
Expand Down

0 comments on commit b04ab88

Please sign in to comment.