idmtools-platform-slurm 0.0.0.dev0__tar.gz → 0.0.2__tar.gz

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.
Files changed (76) hide show
  1. idmtools_platform_slurm-0.0.2/.bumpversion.cfg +28 -0
  2. idmtools_platform_slurm-0.0.2/LICENSE.TXT +3 -0
  3. idmtools_platform_slurm-0.0.2/MANIFEST.in +3 -0
  4. idmtools_platform_slurm-0.0.2/Makefile +5 -0
  5. idmtools_platform_slurm-0.0.2/PKG-INFO +185 -0
  6. idmtools_platform_slurm-0.0.2/README.md +162 -0
  7. idmtools_platform_slurm-0.0.2/dockerized_slurm/Dockerfile +107 -0
  8. idmtools_platform_slurm-0.0.2/dockerized_slurm/README.md +17 -0
  9. idmtools_platform_slurm-0.0.2/dockerized_slurm/docker-compose.yml +89 -0
  10. idmtools_platform_slurm-0.0.2/dockerized_slurm/docker-entrypoint.sh +64 -0
  11. idmtools_platform_slurm-0.0.2/dockerized_slurm/id_rsa +27 -0
  12. idmtools_platform_slurm-0.0.2/dockerized_slurm/id_rsa.pub +1 -0
  13. idmtools_platform_slurm-0.0.2/dockerized_slurm/register_cluster.sh +12 -0
  14. idmtools_platform_slurm-0.0.2/dockerized_slurm/slurm.conf +94 -0
  15. idmtools_platform_slurm-0.0.2/dockerized_slurm/slurmdbd.conf +37 -0
  16. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/__init__.py +12 -0
  17. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/assets/__init__.py +157 -0
  18. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/assets/_run.sh.jinja2 +44 -0
  19. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/assets/batch.sh.jinja2 +54 -0
  20. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/assets/run_simulation.sh +23 -0
  21. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/assets/sbatch.sh.jinja2 +77 -0
  22. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/cli/__init__.py +4 -0
  23. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/cli/slurm.py +151 -0
  24. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/platform_operations/__init__.py +0 -0
  25. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/platform_operations/asset_collection_operations.py +25 -0
  26. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/platform_operations/experiment_operations.py +107 -0
  27. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/platform_operations/json_metadata_operations.py +17 -0
  28. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/platform_operations/simulation_operations.py +46 -0
  29. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/platform_operations/suite_operations.py +38 -0
  30. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/platform_operations/utils.py +45 -0
  31. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/plugin_info.py +75 -0
  32. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/slurm_operations/__init__.py +5 -0
  33. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/slurm_operations/slurm_operations.py +58 -0
  34. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/slurm_platform.py +207 -0
  35. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/utils/__init__.py +4 -0
  36. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/utils/slurm_job/__init__.py +90 -0
  37. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/utils/slurm_job/script_sbatch.sh.jinja2 +78 -0
  38. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/utils/slurm_job/slurm_job.py +214 -0
  39. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/utils/status_report/__init__.py +5 -0
  40. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/utils/status_report/status_report.py +242 -0
  41. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm/utils/status_report/utils.py +108 -0
  42. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm.egg-info/PKG-INFO +185 -0
  43. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm.egg-info/SOURCES.txt +68 -0
  44. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm.egg-info/entry_points.txt +5 -0
  45. idmtools_platform_slurm-0.0.2/idmtools_platform_slurm.egg-info/requires.txt +7 -0
  46. {idmtools_platform_slurm-0.0.0.dev0 → idmtools_platform_slurm-0.0.2}/idmtools_platform_slurm.egg-info/top_level.txt +2 -0
  47. idmtools_platform_slurm-0.0.2/metadata.puml +12 -0
  48. idmtools_platform_slurm-0.0.2/pyproject.toml +67 -0
  49. {idmtools_platform_slurm-0.0.0.dev0 → idmtools_platform_slurm-0.0.2}/setup.cfg +4 -4
  50. idmtools_platform_slurm-0.0.2/slurm_file_operations.puml +25 -0
  51. idmtools_platform_slurm-0.0.2/tests/.coveragerc +12 -0
  52. idmtools_platform_slurm-0.0.2/tests/Makefile +9 -0
  53. idmtools_platform_slurm-0.0.2/tests/__init__.py +0 -0
  54. idmtools_platform_slurm-0.0.2/tests/helper.py +70 -0
  55. idmtools_platform_slurm-0.0.2/tests/idmtools.ini +33 -0
  56. idmtools_platform_slurm-0.0.2/tests/input/hello.sh +2 -0
  57. idmtools_platform_slurm-0.0.2/tests/input/script.py +49 -0
  58. idmtools_platform_slurm-0.0.2/tests/pytest.ini +16 -0
  59. idmtools_platform_slurm-0.0.2/tests/test_analyzers.py +90 -0
  60. idmtools_platform_slurm-0.0.2/tests/test_create_sim_directory_map.py +74 -0
  61. idmtools_platform_slurm-0.0.2/tests/test_folder.py +136 -0
  62. idmtools_platform_slurm-0.0.2/tests/test_hooks.py +85 -0
  63. idmtools_platform_slurm-0.0.2/tests/test_json_metadata_operations.py +398 -0
  64. idmtools_platform_slurm-0.0.2/tests/test_python_simulation.py +228 -0
  65. idmtools_platform_slurm-0.0.2/tests/test_singularity.py +127 -0
  66. idmtools_platform_slurm-0.0.2/tests/test_slurm_job.py +34 -0
  67. idmtools_platform_slurm-0.0.2/tests/test_slurm_operations.py +292 -0
  68. idmtools_platform_slurm-0.0.2/tests/test_slurm_platform.py +248 -0
  69. idmtools_platform_slurm-0.0.2/tests/test_suite_experiment.py +260 -0
  70. idmtools_platform_slurm-0.0.0.dev0/PKG-INFO +0 -41
  71. idmtools_platform_slurm-0.0.0.dev0/README.md +0 -21
  72. idmtools_platform_slurm-0.0.0.dev0/idmtools_platform_slurm/__init__.py +0 -8
  73. idmtools_platform_slurm-0.0.0.dev0/idmtools_platform_slurm.egg-info/PKG-INFO +0 -41
  74. idmtools_platform_slurm-0.0.0.dev0/idmtools_platform_slurm.egg-info/SOURCES.txt +0 -7
  75. idmtools_platform_slurm-0.0.0.dev0/pyproject.toml +0 -32
  76. {idmtools_platform_slurm-0.0.0.dev0 → idmtools_platform_slurm-0.0.2}/idmtools_platform_slurm.egg-info/dependency_links.txt +0 -0
@@ -0,0 +1,28 @@
1
+ [bumpversion]
2
+ current_version = 3.0.0+nightly
3
+ commit = False
4
+ tag = False
5
+ parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(?P<release>\+\w+)?(\.(?P<build>\d+))?
6
+ serialize =
7
+ {major}.{minor}.{patch}{release}.{build}
8
+ {major}.{minor}.{patch}{release}
9
+ {major}.{minor}.{patch}
10
+
11
+ [bumpversion:part:release]
12
+ optional_value = prod
13
+ first_value = prod
14
+ values =
15
+ prod
16
+ +nightly
17
+
18
+ [bumpversion:file:./idmtools_platform_slurm/__init__.py]
19
+ search = __version__ = "{current_version}"
20
+ replace = __version__ = "{new_version}"
21
+ serialize = {major}.{minor}.{patch}{release}
22
+ {major}.{minor}.{patch}
23
+
24
+ [bumpversion:file:./pyproject.toml]
25
+ search = version = "{current_version}"
26
+ replace = version = "{new_version}"
27
+ serialize = {major}.{minor}.{patch}{release}
28
+ {major}.{minor}.{patch}
@@ -0,0 +1,3 @@
1
+ idmtools is licensed under the Creative Commons Attribution-Noncommercial-ShareAlike 4.0 License.
2
+
3
+ To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode
@@ -0,0 +1,3 @@
1
+ include README.md
2
+ include idmtools_platform_slurm/assets/*
3
+ include LICENSE.TXT
@@ -0,0 +1,5 @@
1
+ PACKAGE_NAME=idmtools_slurm
2
+ include $(abspath ../dev_scripts/package_general.mk)
3
+
4
+ help:
5
+ help-from-makefile -f ../dev_scripts/package_general.mk -f ./Makefile
@@ -0,0 +1,185 @@
1
+ Metadata-Version: 2.4
2
+ Name: idmtools_platform_slurm
3
+ Version: 0.0.2
4
+ Summary: Provides ability to run against Slurm
5
+ Author-email: Sharon Chen <schen@idmod.org>, Clinton Collins <ccollins@idmod.org>, Zhaowei Du <zdu@idmod.org>, Clark Kirkman IV <ckirkman@idmod.org>, Benoit Raybaud <braybaud@idmod.org>
6
+ Project-URL: Homepage, https://github.com/InstituteforDiseaseModeling/idmtools
7
+ Keywords: modeling,IDM
8
+ Classifier: Programming Language :: Python :: 3.8
9
+ Classifier: Programming Language :: Python :: 3.9
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE.TXT
16
+ Requires-Dist: idmtools_platform_general<1.0.0,>=0.0.0
17
+ Requires-Dist: dataclasses-json
18
+ Provides-Extra: test
19
+ Requires-Dist: idmtools[test]; extra == "test"
20
+ Requires-Dist: idmtools_models; extra == "test"
21
+ Requires-Dist: idmtools_test; extra == "test"
22
+ Dynamic: license-file
23
+
24
+ ![Staging: idmtools-platform-slurm](https://github.com/InstituteforDiseaseModeling/idmtools/workflows/Staging:%20idmtools-platform-slurm/badge.svg?branch=dev)
25
+
26
+ # idmtools-platform-slurm
27
+
28
+ <!-- START doctoc generated TOC please keep comment here to allow auto update -->
29
+ <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
30
+ **Table of Contents**
31
+
32
+ - [Introduction](#introduction)
33
+ - [Setting Up Virtual Environment](#setting-up-virtual-environment)
34
+ - [Development Tips](#development-tips)
35
+ - [Manually run a script as a Slurm job](#manually-run-a-script-as-a-slurm-job)
36
+ - [Use SlurmJob to run a script as a Slurm job](#use-slurmjob-to-run-a-script-as-a-slurm-job)
37
+ - [With SlurmPlatform to run a script as a Slurm job](#with-slurmplatform-to-run-a-script-as-a-slurm-job)
38
+ - [Folder structure:](#folder-structure)
39
+
40
+ <!-- END doctoc generated TOC please keep comment here to allow auto update -->
41
+
42
+ ## Introduction
43
+
44
+ **SlurmPlatform** is a platform designed to facilitate the execution of experiments and simulations in slurm cluster.
45
+
46
+ ## Setting Up Virtual Environment
47
+
48
+ To set up a virtual environment for **SlurmPlatform**, follow these steps:
49
+
50
+ 1. **Install Python**
51
+
52
+ Ensure you have Python 3.8+ installed on your system.
53
+
54
+ 2. **Create Virtual Environment**
55
+
56
+ There are multiple ways to create a virtual environment. Below is an example using `venv`:
57
+
58
+ ```bash
59
+ python -m venv slurm_env
60
+ ```
61
+
62
+ 3. **Activate Virtual Environment**
63
+ - On Windows:
64
+ ```bash
65
+ slurm_env\Scripts\activate
66
+ ```
67
+ - On Linux:
68
+ ```bash
69
+ source slurm_env/bin/activate
70
+ ```
71
+
72
+ 4. **Install SlurmPlatform**
73
+ ```bash
74
+ pip install idmtools-platform-slurm --index-url=https://packages.idmod.org/api/pypi/pypi-production/simple
75
+ ```
76
+
77
+ 5. **Install Dependencies**
78
+ ```bash
79
+ pip install -r requirements.txt
80
+ ```
81
+ 6. **Optional(No need step #4 and #5), Install all slurm platform related packages**
82
+ ```bash
83
+ pip install idmtools[slurm] --index-url=https://packages.idmod.org/api/pypi/pypi-production/simple
84
+ ```
85
+
86
+ ## Development Tips
87
+
88
+ There is a Makefile file available for most common development tasks. Here is a list of commands
89
+
90
+ ```bash
91
+ clean - Clean up temproary files
92
+ lint - Lint package and tests
93
+ test - Run All tests
94
+ coverage - Run tests and generate coverage report that is shown in browser
95
+ ```
96
+
97
+ On Windows, you can use `pymake` instead of `make`
98
+
99
+
100
+ ## Manually run a script as a Slurm job
101
+
102
+ Preparation
103
+
104
+ (1).Have target script ready, say my_script.py, suppose you have folder structure like::
105
+
106
+ ```bash
107
+ script_folder
108
+ my_script.py
109
+ ......
110
+ ```
111
+
112
+ (2). Created a virtual environment and activated it.
113
+
114
+ Steps
115
+
116
+ 1. within the target script folder, create a batch file 'sbatch.sh' (without quote) with content:
117
+
118
+ ```bash
119
+ #!/bin/bash
120
+
121
+ #SBATCH --partition=b1139
122
+ #SBATCH --time=10:00:00
123
+ #SBATCH --account=b1139
124
+
125
+ #SBATCH --output=stdout.txt
126
+ #SBATCH --error=stderr.txt
127
+
128
+ # replace with your script file
129
+ python3 my_script.py
130
+
131
+ exit $RESULT
132
+ ```
133
+
134
+ Note: the content here is based on Northwestern University QUEST Slurm system. For general case, above content (required #SBATCH parameters) may be a little bit different.
135
+
136
+ 2. run your target script as SLURM job
137
+ execute the following commands from console (under virtual environment):
138
+
139
+ cd path_to_script_folder
140
+
141
+ `sbatch sbatch.sh`
142
+
143
+ Note: any output information from my_script.py is stored in file stdout.txt under the current folder. For example, if my_script.py kicks out another Slurm job, then its Slurm id information can be found in file stdout.txt.
144
+
145
+
146
+ ## Use SlurmJob to run a script as a Slurm job
147
+
148
+ The example can be simple as the following:
149
+
150
+ --script.py--
151
+
152
+ ```python
153
+
154
+ from idmtools.core.platform_factory import Platform
155
+ from idmtools_platform_slurm.utils.slurm_job.slurm_job import SlurmJob
156
+
157
+ script = '<user script path>'
158
+ # script = 'example_path/python_sim_slurm.py' # example
159
+ platform = Platform('SLURM_LOCAL', job_directory='<job_directory>')
160
+ sj = SlurmJob(script_path=script, platform=platform)
161
+ sj.run()
162
+ ```
163
+
164
+ ## With SlurmPlatform to run a script as a Slurm job
165
+
166
+ We have SlurmJob integrated into SlurmPlatform and any Python script can run as a Slurm job simply doing:
167
+
168
+ --script.py--
169
+ ```python
170
+
171
+ from idmtools.entities.command_task import CommandTask
172
+ from idmtools.entities.experiment import Experiment
173
+ from idmtools.core.platform_factory import Platform
174
+
175
+ platform = Platform('SLURM_LOCAL', job_directory='<job_directory>')
176
+ # Define task
177
+ command = "echo 'Hello, World!'"
178
+ task = CommandTask(command=command)
179
+ # Run an experiment
180
+ experiment = Experiment.from_task(task, name="example")
181
+ experiment.run(platform=platform)
182
+ ```
183
+
184
+ ## Folder structure:
185
+ [See Folder Structure](../idmtools_platform_container/README.md#folder-structure)
@@ -0,0 +1,162 @@
1
+ ![Staging: idmtools-platform-slurm](https://github.com/InstituteforDiseaseModeling/idmtools/workflows/Staging:%20idmtools-platform-slurm/badge.svg?branch=dev)
2
+
3
+ # idmtools-platform-slurm
4
+
5
+ <!-- START doctoc generated TOC please keep comment here to allow auto update -->
6
+ <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
7
+ **Table of Contents**
8
+
9
+ - [Introduction](#introduction)
10
+ - [Setting Up Virtual Environment](#setting-up-virtual-environment)
11
+ - [Development Tips](#development-tips)
12
+ - [Manually run a script as a Slurm job](#manually-run-a-script-as-a-slurm-job)
13
+ - [Use SlurmJob to run a script as a Slurm job](#use-slurmjob-to-run-a-script-as-a-slurm-job)
14
+ - [With SlurmPlatform to run a script as a Slurm job](#with-slurmplatform-to-run-a-script-as-a-slurm-job)
15
+ - [Folder structure:](#folder-structure)
16
+
17
+ <!-- END doctoc generated TOC please keep comment here to allow auto update -->
18
+
19
+ ## Introduction
20
+
21
+ **SlurmPlatform** is a platform designed to facilitate the execution of experiments and simulations in slurm cluster.
22
+
23
+ ## Setting Up Virtual Environment
24
+
25
+ To set up a virtual environment for **SlurmPlatform**, follow these steps:
26
+
27
+ 1. **Install Python**
28
+
29
+ Ensure you have Python 3.8+ installed on your system.
30
+
31
+ 2. **Create Virtual Environment**
32
+
33
+ There are multiple ways to create a virtual environment. Below is an example using `venv`:
34
+
35
+ ```bash
36
+ python -m venv slurm_env
37
+ ```
38
+
39
+ 3. **Activate Virtual Environment**
40
+ - On Windows:
41
+ ```bash
42
+ slurm_env\Scripts\activate
43
+ ```
44
+ - On Linux:
45
+ ```bash
46
+ source slurm_env/bin/activate
47
+ ```
48
+
49
+ 4. **Install SlurmPlatform**
50
+ ```bash
51
+ pip install idmtools-platform-slurm --index-url=https://packages.idmod.org/api/pypi/pypi-production/simple
52
+ ```
53
+
54
+ 5. **Install Dependencies**
55
+ ```bash
56
+ pip install -r requirements.txt
57
+ ```
58
+ 6. **Optional(No need step #4 and #5), Install all slurm platform related packages**
59
+ ```bash
60
+ pip install idmtools[slurm] --index-url=https://packages.idmod.org/api/pypi/pypi-production/simple
61
+ ```
62
+
63
+ ## Development Tips
64
+
65
+ There is a Makefile file available for most common development tasks. Here is a list of commands
66
+
67
+ ```bash
68
+ clean - Clean up temproary files
69
+ lint - Lint package and tests
70
+ test - Run All tests
71
+ coverage - Run tests and generate coverage report that is shown in browser
72
+ ```
73
+
74
+ On Windows, you can use `pymake` instead of `make`
75
+
76
+
77
+ ## Manually run a script as a Slurm job
78
+
79
+ Preparation
80
+
81
+ (1).Have target script ready, say my_script.py, suppose you have folder structure like::
82
+
83
+ ```bash
84
+ script_folder
85
+ my_script.py
86
+ ......
87
+ ```
88
+
89
+ (2). Created a virtual environment and activated it.
90
+
91
+ Steps
92
+
93
+ 1. within the target script folder, create a batch file 'sbatch.sh' (without quote) with content:
94
+
95
+ ```bash
96
+ #!/bin/bash
97
+
98
+ #SBATCH --partition=b1139
99
+ #SBATCH --time=10:00:00
100
+ #SBATCH --account=b1139
101
+
102
+ #SBATCH --output=stdout.txt
103
+ #SBATCH --error=stderr.txt
104
+
105
+ # replace with your script file
106
+ python3 my_script.py
107
+
108
+ exit $RESULT
109
+ ```
110
+
111
+ Note: the content here is based on Northwestern University QUEST Slurm system. For general case, above content (required #SBATCH parameters) may be a little bit different.
112
+
113
+ 2. run your target script as SLURM job
114
+ execute the following commands from console (under virtual environment):
115
+
116
+ cd path_to_script_folder
117
+
118
+ `sbatch sbatch.sh`
119
+
120
+ Note: any output information from my_script.py is stored in file stdout.txt under the current folder. For example, if my_script.py kicks out another Slurm job, then its Slurm id information can be found in file stdout.txt.
121
+
122
+
123
+ ## Use SlurmJob to run a script as a Slurm job
124
+
125
+ The example can be simple as the following:
126
+
127
+ --script.py--
128
+
129
+ ```python
130
+
131
+ from idmtools.core.platform_factory import Platform
132
+ from idmtools_platform_slurm.utils.slurm_job.slurm_job import SlurmJob
133
+
134
+ script = '<user script path>'
135
+ # script = 'example_path/python_sim_slurm.py' # example
136
+ platform = Platform('SLURM_LOCAL', job_directory='<job_directory>')
137
+ sj = SlurmJob(script_path=script, platform=platform)
138
+ sj.run()
139
+ ```
140
+
141
+ ## With SlurmPlatform to run a script as a Slurm job
142
+
143
+ We have SlurmJob integrated into SlurmPlatform and any Python script can run as a Slurm job simply doing:
144
+
145
+ --script.py--
146
+ ```python
147
+
148
+ from idmtools.entities.command_task import CommandTask
149
+ from idmtools.entities.experiment import Experiment
150
+ from idmtools.core.platform_factory import Platform
151
+
152
+ platform = Platform('SLURM_LOCAL', job_directory='<job_directory>')
153
+ # Define task
154
+ command = "echo 'Hello, World!'"
155
+ task = CommandTask(command=command)
156
+ # Run an experiment
157
+ experiment = Experiment.from_task(task, name="example")
158
+ experiment.run(platform=platform)
159
+ ```
160
+
161
+ ## Folder structure:
162
+ [See Folder Structure](../idmtools_platform_container/README.md#folder-structure)
@@ -0,0 +1,107 @@
1
+ FROM centos:7
2
+
3
+ LABEL org.opencontainers.image.source="https://github.com/giovtorres/slurm-docker-cluster" \
4
+ org.opencontainers.image.title="slurm-docker-cluster" \
5
+ org.opencontainers.image.description="Slurm Docker cluster on CentOS 7" \
6
+ org.label-schema.docker.cmd="docker-compose up -d" \
7
+ maintainer="Giovanni Torres"
8
+
9
+ ARG SLURM_TAG=slurm-19-05-1-2
10
+ ARG GOSU_VERSION=1.11
11
+
12
+ RUN set -ex \
13
+ && yum makecache fast \
14
+ && yum -y update \
15
+ && yum -y install epel-release \
16
+ && yum -y install \
17
+ wget \
18
+ bzip2 \
19
+ perl \
20
+ gcc \
21
+ gcc-c++\
22
+ git \
23
+ gnupg \
24
+ make \
25
+ munge \
26
+ munge-devel \
27
+ openssh-server \
28
+ python-devel \
29
+ python-pip \
30
+ python36 \
31
+ python36-devel \
32
+ python36-pip \
33
+ mariadb-server \
34
+ mariadb-devel \
35
+ psmisc \
36
+ bash-completion \
37
+ vim-enhanced \
38
+ && yum clean all \
39
+ && rm -rf /var/cache/yum
40
+
41
+ RUN pip install Cython nose && pip3.6 install Cython nose
42
+
43
+ RUN set -ex \
44
+ && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-amd64" \
45
+ && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-amd64.asc" \
46
+ && export GNUPGHOME="$(mktemp -d)" \
47
+ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
48
+ && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
49
+ && rm -rf "${GNUPGHOME}" /usr/local/bin/gosu.asc \
50
+ && chmod +x /usr/local/bin/gosu \
51
+ && gosu nobody true
52
+
53
+ RUN set -x \
54
+ && git clone https://github.com/SchedMD/slurm.git \
55
+ && pushd slurm \
56
+ && git checkout tags/$SLURM_TAG \
57
+ && ./configure --enable-debug --prefix=/usr --sysconfdir=/etc/slurm \
58
+ --with-mysql_config=/usr/bin --libdir=/usr/lib64 \
59
+ && make install \
60
+ && install -D -m644 etc/cgroup.conf.example /etc/slurm/cgroup.conf.example \
61
+ && install -D -m644 etc/slurm.conf.example /etc/slurm/slurm.conf.example \
62
+ && install -D -m644 etc/slurmdbd.conf.example /etc/slurm/slurmdbd.conf.example \
63
+ && install -D -m644 contribs/slurm_completion_help/slurm_completion.sh /etc/profile.d/slurm_completion.sh \
64
+ && popd \
65
+ && rm -rf slurm
66
+ RUN /usr/bin/ssh-keygen -A \
67
+ && groupadd -r --gid=996 slurm-data \
68
+ && groupadd -r --gid=995 slurm \
69
+ && useradd -r -g slurm -G slurm-data --uid=995 slurm \
70
+ && groupadd -r --gid=1005 test \
71
+ && useradd -r -g test -G slurm-data --uid=1005 test \
72
+ && echo "test:test" | chpasswd \
73
+ && mkdir -p /home/test/.ssh \
74
+ && chown -R test:test /home/test \
75
+ && mkdir /etc/sysconfig/slurm \
76
+ /var/spool/slurmd \
77
+ /var/run/slurmd \
78
+ /var/run/slurmdbd \
79
+ /var/lib/slurmd \
80
+ /var/log/slurm \
81
+ /data \
82
+ && touch /var/lib/slurmd/node_state \
83
+ /var/lib/slurmd/front_end_state \
84
+ /var/lib/slurmd/job_state \
85
+ /var/lib/slurmd/resv_state \
86
+ /var/lib/slurmd/trigger_state \
87
+ /var/lib/slurmd/assoc_mgr_state \
88
+ /var/lib/slurmd/assoc_usage \
89
+ /var/lib/slurmd/qos_usage \
90
+ /var/lib/slurmd/fed_mgr_state \
91
+ && chown -R slurm:slurm /var/*/slurm* \
92
+ && /sbin/create-munge-key
93
+
94
+ COPY id_rsa id_rsa.pub /home/test/.ssh/
95
+ COPY slurm.conf /etc/slurm/slurm.conf
96
+ COPY slurmdbd.conf /etc/slurm/slurmdbd.conf
97
+
98
+
99
+ RUN cp /home/test/.ssh/id_rsa.pub /home/test/.ssh/authorized_keys \
100
+ && chmod 400 /home/test/.ssh/id_rsa.pub \
101
+ && chmod 644 /home/test/.ssh/authorized_keys \
102
+ && chown -R 1005:1005 /home/test/.ssh/
103
+
104
+ COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
105
+ ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
106
+
107
+ CMD ["slurmdbd"]
@@ -0,0 +1,17 @@
1
+ <!-- START doctoc generated TOC please keep comment here to allow auto update -->
2
+ <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3
+
4
+
5
+
6
+ <!-- END doctoc generated TOC please keep comment here to allow auto update -->
7
+
8
+ To use the slurm docker test platform, you need to follow these steps
9
+
10
+ 1. Within this directory, run docker-compose up -d
11
+ 2. Wait one minute are check the docker logs. Once the slurmctld is ready, then go to the next step
12
+ 3. Run register_cluster.sh . On windows, you can run the docker-compose exec commands
13
+ 4. Grab the IP Address of slurmctld
14
+ `docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' slurmctld`
15
+ 5. Update the remote_host to the ip address from previous output in idmtools_platform_slurm/tests/idmtools.ini
16
+ 6. Update the key_file path in idmtools_platform_slurm/tests/idmtools.ini to point to the absolute path of the
17
+ idmtools_platform_slurm/dockerized_slurm/id_rsa on your machine
@@ -0,0 +1,89 @@
1
+ version: "2.2"
2
+
3
+ services:
4
+ mysql:
5
+ image: mysql:5.7
6
+ hostname: mysql
7
+ container_name: mysql
8
+ environment:
9
+ MYSQL_RANDOM_ROOT_PASSWORD: "yes"
10
+ MYSQL_DATABASE: slurm_acct_db
11
+ MYSQL_USER: slurm
12
+ MYSQL_PASSWORD: password
13
+ volumes:
14
+ - var_lib_mysql:/var/lib/mysql
15
+
16
+ slurmdbd:
17
+ image: slurm-docker-cluster:19.05.1
18
+ build:
19
+ context: .
20
+ command: ["slurmdbd"]
21
+ container_name: slurmdbd
22
+ hostname: slurmdbd
23
+ volumes:
24
+ - etc_munge:/etc/munge
25
+ - etc_slurm:/etc/slurm
26
+ - var_log_slurm:/var/log/slurm
27
+ expose:
28
+ - "6819"
29
+ depends_on:
30
+ - mysql
31
+
32
+ slurmctld:
33
+ image: slurm-docker-cluster:19.05.1
34
+ build:
35
+ context: .
36
+ command: ["slurmctld"]
37
+ container_name: slurmctld
38
+ hostname: slurmctld
39
+ volumes:
40
+ - etc_munge:/etc/munge
41
+ - etc_slurm:/etc/slurm
42
+ - ./test_slurm_data:/data
43
+ - var_log_slurm:/var/log/slurm
44
+ expose:
45
+ - "6817"
46
+ ports:
47
+ - "2222:22"
48
+ depends_on:
49
+ - "slurmdbd"
50
+
51
+ c1:
52
+ image: slurm-docker-cluster:19.05.1
53
+ build:
54
+ context: .
55
+ command: ["slurmd"]
56
+ hostname: c1
57
+ container_name: c1
58
+ volumes:
59
+ - etc_munge:/etc/munge
60
+ - etc_slurm:/etc/slurm
61
+ - ./test_slurm_data:/data
62
+ - var_log_slurm:/var/log/slurm
63
+ expose:
64
+ - "6818"
65
+ depends_on:
66
+ - "slurmctld"
67
+
68
+ c2:
69
+ image: slurm-docker-cluster:19.05.1
70
+ build:
71
+ context: .
72
+ command: ["slurmd"]
73
+ hostname: c2
74
+ container_name: c2
75
+ volumes:
76
+ - etc_munge:/etc/munge
77
+ - etc_slurm:/etc/slurm
78
+ - ./test_slurm_data:/data
79
+ - var_log_slurm:/var/log/slurm
80
+ expose:
81
+ - "6818"
82
+ depends_on:
83
+ - "slurmctld"
84
+
85
+ volumes:
86
+ etc_munge:
87
+ etc_slurm:
88
+ var_lib_mysql:
89
+ var_log_slurm:
@@ -0,0 +1,64 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ chown -R slurm:slurm-data /data
5
+ chmod 0775 /data
6
+
7
+ if [ "$1" = "slurmdbd" ]
8
+ then
9
+ echo "---> Starting the MUNGE Authentication service (munged) ..."
10
+ gosu munge /usr/sbin/munged
11
+
12
+ echo "---> Starting the Slurm Database Daemon (slurmdbd) ..."
13
+
14
+ {
15
+ . /etc/slurm/slurmdbd.conf
16
+ until echo "SELECT 1" | mysql -h $StorageHost -u$StorageUser -p$StoragePass 2>&1 > /dev/null
17
+ do
18
+ echo "-- Waiting for database to become active ..."
19
+ sleep 2
20
+ done
21
+ }
22
+ echo "-- Database is now active ..."
23
+
24
+ exec gosu slurm /usr/sbin/slurmdbd -Dvvv
25
+ fi
26
+
27
+ if [ "$1" = "slurmctld" ]
28
+ then
29
+ echo "---> Starting the MUNGE Authentication service (munged) ..."
30
+ gosu munge /usr/sbin/munged
31
+
32
+ echo "---> Waiting for slurmdbd to become active before starting slurmctld ..."
33
+
34
+ until 2>/dev/null >/dev/tcp/slurmdbd/6819
35
+ do
36
+ echo "-- slurmdbd is not available. Sleeping ..."
37
+ sleep 2
38
+ done
39
+ echo "-- slurmdbd is now active ..."
40
+
41
+ echo "---> Starting the Slurm Controller Daemon (slurmctld) ..."
42
+ exec /usr/sbin/sshd -D &
43
+ exec gosu slurm /usr/sbin/slurmctld -Dvvv
44
+ fi
45
+
46
+ if [ "$1" = "slurmd" ]
47
+ then
48
+ echo "---> Starting the MUNGE Authentication service (munged) ..."
49
+ gosu munge /usr/sbin/munged
50
+
51
+ echo "---> Waiting for slurmctld to become active before starting slurmd..."
52
+
53
+ until 2>/dev/null >/dev/tcp/slurmctld/6817
54
+ do
55
+ echo "-- slurmctld is not available. Sleeping ..."
56
+ sleep 2
57
+ done
58
+ echo "-- slurmctld is now active ..."
59
+
60
+ echo "---> Starting the Slurm Node Daemon (slurmd) ..."
61
+ exec /usr/sbin/slurmd -Dvvv
62
+ fi
63
+
64
+ exec "$@"