server-simulator 0.1.0__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 (89) hide show
  1. server_simulator-0.1.0/.github/workflows/publish.yml +29 -0
  2. server_simulator-0.1.0/.github/workflows/tests.yml +48 -0
  3. server_simulator-0.1.0/.gitignore +217 -0
  4. server_simulator-0.1.0/.idea/.gitignore +3 -0
  5. server_simulator-0.1.0/.idea/dictionaries/project.xml +7 -0
  6. server_simulator-0.1.0/.idea/inspectionProfiles/profiles_settings.xml +6 -0
  7. server_simulator-0.1.0/.idea/misc.xml +7 -0
  8. server_simulator-0.1.0/.idea/modules.xml +8 -0
  9. server_simulator-0.1.0/.idea/server-simulator.iml +10 -0
  10. server_simulator-0.1.0/.idea/vcs.xml +6 -0
  11. server_simulator-0.1.0/.pre-commit-config.yaml +25 -0
  12. server_simulator-0.1.0/.python-version +1 -0
  13. server_simulator-0.1.0/LICENSE +21 -0
  14. server_simulator-0.1.0/PKG-INFO +115 -0
  15. server_simulator-0.1.0/README.md +103 -0
  16. server_simulator-0.1.0/TODO.md +19 -0
  17. server_simulator-0.1.0/pyproject.toml +49 -0
  18. server_simulator-0.1.0/src/__init__.py +0 -0
  19. server_simulator-0.1.0/src/envs/__init__.py +75 -0
  20. server_simulator-0.1.0/src/envs/cluster_simulator/__init__.py +0 -0
  21. server_simulator-0.1.0/src/envs/cluster_simulator/actions.py +55 -0
  22. server_simulator-0.1.0/src/envs/cluster_simulator/base/__init__.py +0 -0
  23. server_simulator-0.1.0/src/envs/cluster_simulator/base/extractors/__init__.py +0 -0
  24. server_simulator-0.1.0/src/envs/cluster_simulator/base/extractors/information.py +26 -0
  25. server_simulator-0.1.0/src/envs/cluster_simulator/base/extractors/observation.py +41 -0
  26. server_simulator-0.1.0/src/envs/cluster_simulator/base/extractors/reward.py +29 -0
  27. server_simulator-0.1.0/src/envs/cluster_simulator/base/internal/cluster.py +137 -0
  28. server_simulator-0.1.0/src/envs/cluster_simulator/base/internal/dilation.py +189 -0
  29. server_simulator-0.1.0/src/envs/cluster_simulator/base/internal/job.py +63 -0
  30. server_simulator-0.1.0/src/envs/cluster_simulator/base/internal/machine.py +33 -0
  31. server_simulator-0.1.0/src/envs/cluster_simulator/base/renderer.py +34 -0
  32. server_simulator-0.1.0/src/envs/cluster_simulator/basic.py +74 -0
  33. server_simulator-0.1.0/src/envs/cluster_simulator/deep_rm/__init__.py +164 -0
  34. server_simulator-0.1.0/src/envs/cluster_simulator/deep_rm/creator.py +48 -0
  35. server_simulator-0.1.0/src/envs/cluster_simulator/deep_rm/internal/custom_type.py +21 -0
  36. server_simulator-0.1.0/src/envs/cluster_simulator/deep_rm/internal/jobs.py +77 -0
  37. server_simulator-0.1.0/src/envs/cluster_simulator/deep_rm/internal/machines.py +56 -0
  38. server_simulator-0.1.0/src/envs/cluster_simulator/deep_rm/observation.py +79 -0
  39. server_simulator-0.1.0/src/envs/cluster_simulator/metric_based/__init__.py +155 -0
  40. server_simulator-0.1.0/src/envs/cluster_simulator/metric_based/creator.py +52 -0
  41. server_simulator-0.1.0/src/envs/cluster_simulator/metric_based/internal/custom_type.py +20 -0
  42. server_simulator-0.1.0/src/envs/cluster_simulator/metric_based/internal/dilation.py +83 -0
  43. server_simulator-0.1.0/src/envs/cluster_simulator/metric_based/internal/jobs.py +80 -0
  44. server_simulator-0.1.0/src/envs/cluster_simulator/metric_based/internal/machines.py +56 -0
  45. server_simulator-0.1.0/src/envs/cluster_simulator/metric_based/observation.py +80 -0
  46. server_simulator-0.1.0/src/envs/cluster_simulator/metric_based/renderer.py +541 -0
  47. server_simulator-0.1.0/src/envs/cluster_simulator/single_slot/__init__.py +84 -0
  48. server_simulator-0.1.0/src/envs/cluster_simulator/single_slot/creator.py +47 -0
  49. server_simulator-0.1.0/src/envs/cluster_simulator/single_slot/internal/jobs.py +50 -0
  50. server_simulator-0.1.0/src/envs/cluster_simulator/single_slot/internal/machines.py +49 -0
  51. server_simulator-0.1.0/src/envs/cluster_simulator/single_slot/observation.py +68 -0
  52. server_simulator-0.1.0/src/envs/cluster_simulator/utils/__init__.py +0 -0
  53. server_simulator-0.1.0/src/envs/cluster_simulator/utils/array_operations.py +197 -0
  54. server_simulator-0.1.0/src/scheduler/__init__.py +7 -0
  55. server_simulator-0.1.0/src/scheduler/base_scheduler.py +38 -0
  56. server_simulator-0.1.0/src/scheduler/first_come_first_served_scheduler.py +36 -0
  57. server_simulator-0.1.0/src/scheduler/random_scheduler.py +41 -0
  58. server_simulator-0.1.0/src/scheduler/round_robin_scheduler.py +51 -0
  59. server_simulator-0.1.0/src/scheduler/shortest_job_first_scheduler.py +47 -0
  60. server_simulator-0.1.0/src/wrappers/cluster_simulator/__init__.py +0 -0
  61. server_simulator-0.1.0/src/wrappers/cluster_simulator/dilation_wrapper.py +150 -0
  62. server_simulator-0.1.0/src/wrappers/cluster_simulator/render_wrapper.py +60 -0
  63. server_simulator-0.1.0/tests/strategies/cluster_strategies/__init__.py +5 -0
  64. server_simulator-0.1.0/tests/strategies/cluster_strategies/deeprm_st.py +31 -0
  65. server_simulator-0.1.0/tests/strategies/cluster_strategies/metric_st.py +30 -0
  66. server_simulator-0.1.0/tests/strategies/cluster_strategies/proto.py +21 -0
  67. server_simulator-0.1.0/tests/strategies/cluster_strategies/single_slot_st.py +35 -0
  68. server_simulator-0.1.0/tests/strategies/dilation_strategies/metric_cluster_dilator_st.py +75 -0
  69. server_simulator-0.1.0/tests/strategies/dilation_strategies/proto.py +17 -0
  70. server_simulator-0.1.0/tests/strategies/env_strategies/__init__.py +4 -0
  71. server_simulator-0.1.0/tests/strategies/env_strategies/basic_env_st.py +125 -0
  72. server_simulator-0.1.0/tests/test_e2e/test_e2e_deeprm.py +6 -0
  73. server_simulator-0.1.0/tests/test_e2e/test_e2e_matric_based.py +8 -0
  74. server_simulator-0.1.0/tests/test_e2e/test_e2e_single_slot.py +6 -0
  75. server_simulator-0.1.0/tests/test_envs/test_basic_env.py +103 -0
  76. server_simulator-0.1.0/tests/test_envs/test_cluster_simulator/test_core/.gitkeep +0 -0
  77. server_simulator-0.1.0/tests/test_envs/test_cluster_simulator/test_deep_rm/test_deeprm_cluster.py +363 -0
  78. server_simulator-0.1.0/tests/test_envs/test_cluster_simulator/test_metric_based/test_metric_cluster.py +220 -0
  79. server_simulator-0.1.0/tests/test_envs/test_cluster_simulator/test_metric_based/tests_metric_dilation.py +262 -0
  80. server_simulator-0.1.0/tests/test_envs/test_cluster_simulator/test_single_slot/test_single_slot_cluster.py +288 -0
  81. server_simulator-0.1.0/tests/test_envs/test_cluster_simulator/test_single_slot/utils.py +24 -0
  82. server_simulator-0.1.0/tests/test_envs/test_cluster_simulator/test_utils/test_array_operations.py +277 -0
  83. server_simulator-0.1.0/tests/test_wrappers/test_dilation_wrapper.py +82 -0
  84. server_simulator-0.1.0/tests/tests_scheduler/test_basic_scheduler.py +1 -0
  85. server_simulator-0.1.0/tests/tests_scheduler/test_first_come_first_served_scheduler.py +1 -0
  86. server_simulator-0.1.0/tests/tests_scheduler/test_random_scheduler.py +1 -0
  87. server_simulator-0.1.0/tests/tests_scheduler/test_round_robin_scheduler.py +1 -0
  88. server_simulator-0.1.0/tests/tests_scheduler/test_shortest_job_first_scheduler.py +1 -0
  89. server_simulator-0.1.0/uv.lock +759 -0
@@ -0,0 +1,29 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ build-and-publish:
9
+ runs-on: ubuntu-latest
10
+ environment: pypi
11
+ permissions:
12
+ contents: read
13
+ id-token: write
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - uses: astral-sh/setup-uv@v5
19
+ with:
20
+ enable-cache: true
21
+
22
+ - name: Set up Python
23
+ run: uv python install
24
+
25
+ - name: Build package
26
+ run: uv build
27
+
28
+ - name: Publish to PyPI
29
+ run: uv publish
@@ -0,0 +1,48 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
16
+
17
+ steps:
18
+ - name: Checkout repository
19
+ uses: actions/checkout@v4
20
+
21
+ - name: Set up Python
22
+ uses: actions/setup-python@v5
23
+ with:
24
+ python-version: ${{ matrix.python-version }}
25
+
26
+ - name: Install uv
27
+ run: |
28
+ curl -LsSf https://astral.sh/uv/install.sh | sh
29
+
30
+ - name: Install dependencies
31
+ run: |
32
+ uv sync
33
+
34
+ - name: Run Ruff (lint)
35
+ run: |
36
+ uv run ruff check . --fix
37
+ uv run ruff format . --check
38
+
39
+ - name: Run tests with coverage
40
+ run: |
41
+ uv run coverage run -m pytest
42
+ uv run coverage xml
43
+ uv run coverage report -m
44
+
45
+ - name: Upload coverage reports to Codecov
46
+ uses: codecov/codecov-action@v5
47
+ with:
48
+ token: ${{ secrets.CODECOV_TOKEN }}
@@ -0,0 +1,217 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+
204
+ # Ruff stuff:
205
+ .ruff_cache/
206
+
207
+ # PyPI configuration file
208
+ .pypirc
209
+
210
+ # Marimo
211
+ marimo/_static/
212
+ marimo/_lsp/
213
+ __marimo__/
214
+
215
+ # Streamlit
216
+ .streamlit/secrets.toml
217
+ .hypothesis
@@ -0,0 +1,3 @@
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
@@ -0,0 +1,7 @@
1
+ <component name="ProjectDictionaryState">
2
+ <dictionary name="project">
3
+ <words>
4
+ <w>defualt</w>
5
+ </words>
6
+ </dictionary>
7
+ </component>
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Black">
4
+ <option name="sdkName" value="Python 3.10 (server-simulator)" />
5
+ </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (server-simulator)" project-jdk-type="Python SDK" />
7
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/server-simulator.iml" filepath="$PROJECT_DIR$/.idea/server-simulator.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <excludeFolder url="file://$MODULE_DIR$/.venv" />
6
+ </content>
7
+ <orderEntry type="jdk" jdkName="Python 3.10 (server-simulator)" jdkType="Python SDK" />
8
+ <orderEntry type="sourceFolder" forTests="false" />
9
+ </component>
10
+ </module>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,25 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/mirrors-autopep8
3
+ rev: v2.0.4
4
+ hooks:
5
+ - id: autopep8
6
+ args:
7
+ - --in-place
8
+ - --recursive
9
+ - --aggressive
10
+ - --aggressive
11
+
12
+ # - repo: https://github.com/facebook/pyrefly
13
+ # rev: main
14
+ # hooks:
15
+ # - id: pyrefly
16
+ # args: [check]
17
+
18
+ - repo: local
19
+ hooks:
20
+ - id: pytest-coverage
21
+ name: pytest with coverage
22
+ entry: bash -c 'COVERAGE_DISABLE_CACHE=1 coverage run -m pytest && coverage report -m --omit="*/tests/*" && coverage xml --omit="*/tests/*"'
23
+ language: system
24
+ pass_filenames: false
25
+ always_run: true
@@ -0,0 +1 @@
1
+ 3.10
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dev0Guy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,115 @@
1
+ Metadata-Version: 2.4
2
+ Name: server-simulator
3
+ Version: 0.1.0
4
+ Summary: Add your description here
5
+ License-File: LICENSE
6
+ Requires-Python: >=3.10
7
+ Requires-Dist: gymnasium>=1.2.1
8
+ Requires-Dist: numpy>=2.2.6
9
+ Requires-Dist: pygame>=2.6.1
10
+ Requires-Dist: rust-enum>=1.1.5
11
+ Description-Content-Type: text/markdown
12
+
13
+ ![Tests](https://github.com/dev0Guy/server-simulator/actions/workflows/tests.yml/badge.svg?branch=main)
14
+ [![Coverage](https://codecov.io/gh/dev0Guy/server-simulator/branch/main/graph/badge.svg)](https://codecov.io/gh/dev0Guy/server-simulator)
15
+ ![Python](https://img.shields.io/badge/Python-3.10%2B-blue?logo=python)
16
+ ![License](https://img.shields.io/github/license/dev0Guy/server-simulator)
17
+ [![PEP8](https://img.shields.io/badge/code%20style-pep8-orange.svg)](https://www.python.org/dev/peps/pep-0008/)
18
+
19
+ Base Status
20
+ -----------
21
+ We've created 3 Environment for scheduling, which implement the `ClusterABC` with `JobCollection` and `MachineCollection` protocols:
22
+
23
+
24
+ ### SingleSlot Environment
25
+
26
+ | Component | Details |
27
+ |----------|---------|
28
+ | **Description** | Minimal scheduling environment with no temporal memory; each machine and job exposes only its current resource usage. |
29
+ | **State: Machines** | Shape: **[resource_usage]** — a single-cell array indicating current resource utilization (value between 0–1). |
30
+ | **State: Jobs** | Shape: **[resource_usage]** — a single-cell array indicating the current resource requirement (value between 0–1). |
31
+ | **Actions** | Discrete integer: **0 … (num_machines × num_jobs) + 1**. |
32
+ | **Action 0** | Interrupt / time tick (move to next timestamp). |
33
+ | **Action 1+** | Scheduling decision mapping to a specific **(machine, job)** pair. |
34
+
35
+ ### DeepRM Environment
36
+
37
+ | Component | Details |
38
+ |----------|---------|
39
+ | **Description** | Environment inspired by the DeepRM scheduling model, representing fine-grained resource units across time. |
40
+ | **State: Machines** | Tensor shape: **[num_machines, num_resources, num_resource_cells, num_ticks]**. Each cell represents whether resource unit **r_unit** of resource **r** is occupied at time **t**. |
41
+ | **State: Jobs** | Tensor shape: **[num_jobs, num_resources, num_resource_cells, num_ticks]**. Each cell represents whether the job requires resource unit **r_unit** of resource **r** at time **t**. |
42
+ | **Actions** | Discrete integer: **0 … (num_machines × num_jobs) + 1**. |
43
+ | **Action 0** | Interrupt / time tick (advance to next timestamp). |
44
+ | **Action 1+** | Scheduling decision mapping to a specific **(machine, job)** pair. |
45
+
46
+ ### MetricBased Environment
47
+
48
+ | Component | Details |
49
+ |----------|---------|
50
+ | **Description** | Scheduling environment that models resource usage of machines and jobs over time. |
51
+ | **State: Machines** | Tensor shape: **[num_machines, n_resources, n_ticks]**. Each value ∈ **[0–1]** representing machine resource usage for resource **r** at time **t**. |
52
+ | **State: Jobs** | Tensor shape: **[num_jobs, n_resources, n_ticks]**. Each value ∈ **[0–1]** representing job resource demand for resource **r** at time **t**. |
53
+ | **Actions** | Discrete integer: **0 … (num_machines × num_jobs) + 1**. |
54
+ | **Action 0** | Represents an interrupt or a time tick (advance to next timestamp). |
55
+ | **Action 1+** | Represents assigning job **j** to machine **m** (encoded according to environment mapping). |
56
+
57
+ <br>
58
+
59
+ **Dilation Operations:** assuming kernel size (in each dimension) is bigger than 1. By padding the input according to max zoom in possible the service can work for varying kernel sizes.
60
+ In addition, assume that use (in our case the DRL agent) can execute 3 operation with zoomingIn (going up one level -1) or zoomingOut (going out one level +1) or skipping to next timestamp,
61
+ notice that without executing real scheduling (when in last level and select a machine) can't stop and skip.
62
+ Our algorithm represent the state as ndarray of `shape` to `[kernel_x, kernel_y, *shape[1:]]`. <br>
63
+
64
+ **Reward Functions:** for now the only reward function is +1 for scheduling job and changing the job status from pending into running.
65
+
66
+
67
+ Change Log
68
+ -----
69
+ EMPTY
70
+
71
+ Tasks:
72
+ -----
73
+
74
+ #### Important:
75
+
76
+ - [-] Create Dilation Gym Environment Wrapper `DilationWrapper`.
77
+ - [ ] Test `DilationWrapper`.
78
+ - [ ] Implement Render technics to represent and visualize cluster result
79
+ - [ ] Implement different reward Wrapper:
80
+ - [ ] Need to decide which one ??
81
+
82
+
83
+ #### Side Note:
84
+
85
+ - [ ] Create Dilation for DeepRM
86
+ - [ ] Create Tests for DeepRM
87
+
88
+
89
+ Finished Tasks:
90
+ -----
91
+ - [X] Implement global machine Protocol (`Machine`,`MachineCollection`).
92
+ - [X] Implement global job Protocol (`Job`,`JobCollection`).
93
+ - [X] Implement abstract cluster using these protocols, for Cross-functional (`ClusterABC`), where each subclass implement the creation of jobs and machines.
94
+ - [X] Test `ClusterABC` (property based).
95
+ - [X] Implement Single slot cluster using the abstract class (`SingleSlotCluster`).
96
+ - [X] Test `SingleSlotCluster` (property based).
97
+ - [X] Implement DeepRM cluster using the abstract class (`DeepRMCluster`).
98
+ - [X] Test `DeepRMCluster` (property based).
99
+ - [X] Implement MetricBased cluster using the abstract class (`MetricCluster`).
100
+ - [X] Test `MetricCluster` (property based).
101
+ - [X] Implement Gym Environment that get cluster as dependency `BasicClusterEnv`.
102
+ - [X] Test `BasicClusterEnv` (property based) using random scheduler (`RandomScheduler`).
103
+ - [X] Implement Dilation Protocol `DilationProtocol`.
104
+ - [X] Implement Dilation numpy functionality (`hierarchical_pooling`, `get_window_from_cell`, etc..) `array_operation.py`.
105
+ - [X] Test Dilation numpy functionality.
106
+ - [X] Implement Dilation Service for Metric based cluster `MetricBasedDilator`.
107
+ - [X] Test Dilation `MetricBasedDilator`.
108
+
109
+ ## Assumption
110
+ - Dilation assume that cluster state is bigger than dilation & the kernel has no 1 in each of its diminution
111
+ - For each Step which is not real allocation reward is set to 0
112
+ - On each job has reward of 1 if change status to running
113
+ - Dilation is operating by taking [n_machine, n_resource, n_ticks] and
114
+ padding to perpetrate size of [max_x_kernl, max_y_kernel, n_resources, n_ticks]
115
+ - Dilation implement both zoom in and zoom out when arriving to level 0 will cause real scheduling
@@ -0,0 +1,103 @@
1
+ ![Tests](https://github.com/dev0Guy/server-simulator/actions/workflows/tests.yml/badge.svg?branch=main)
2
+ [![Coverage](https://codecov.io/gh/dev0Guy/server-simulator/branch/main/graph/badge.svg)](https://codecov.io/gh/dev0Guy/server-simulator)
3
+ ![Python](https://img.shields.io/badge/Python-3.10%2B-blue?logo=python)
4
+ ![License](https://img.shields.io/github/license/dev0Guy/server-simulator)
5
+ [![PEP8](https://img.shields.io/badge/code%20style-pep8-orange.svg)](https://www.python.org/dev/peps/pep-0008/)
6
+
7
+ Base Status
8
+ -----------
9
+ We've created 3 Environment for scheduling, which implement the `ClusterABC` with `JobCollection` and `MachineCollection` protocols:
10
+
11
+
12
+ ### SingleSlot Environment
13
+
14
+ | Component | Details |
15
+ |----------|---------|
16
+ | **Description** | Minimal scheduling environment with no temporal memory; each machine and job exposes only its current resource usage. |
17
+ | **State: Machines** | Shape: **[resource_usage]** — a single-cell array indicating current resource utilization (value between 0–1). |
18
+ | **State: Jobs** | Shape: **[resource_usage]** — a single-cell array indicating the current resource requirement (value between 0–1). |
19
+ | **Actions** | Discrete integer: **0 … (num_machines × num_jobs) + 1**. |
20
+ | **Action 0** | Interrupt / time tick (move to next timestamp). |
21
+ | **Action 1+** | Scheduling decision mapping to a specific **(machine, job)** pair. |
22
+
23
+ ### DeepRM Environment
24
+
25
+ | Component | Details |
26
+ |----------|---------|
27
+ | **Description** | Environment inspired by the DeepRM scheduling model, representing fine-grained resource units across time. |
28
+ | **State: Machines** | Tensor shape: **[num_machines, num_resources, num_resource_cells, num_ticks]**. Each cell represents whether resource unit **r_unit** of resource **r** is occupied at time **t**. |
29
+ | **State: Jobs** | Tensor shape: **[num_jobs, num_resources, num_resource_cells, num_ticks]**. Each cell represents whether the job requires resource unit **r_unit** of resource **r** at time **t**. |
30
+ | **Actions** | Discrete integer: **0 … (num_machines × num_jobs) + 1**. |
31
+ | **Action 0** | Interrupt / time tick (advance to next timestamp). |
32
+ | **Action 1+** | Scheduling decision mapping to a specific **(machine, job)** pair. |
33
+
34
+ ### MetricBased Environment
35
+
36
+ | Component | Details |
37
+ |----------|---------|
38
+ | **Description** | Scheduling environment that models resource usage of machines and jobs over time. |
39
+ | **State: Machines** | Tensor shape: **[num_machines, n_resources, n_ticks]**. Each value ∈ **[0–1]** representing machine resource usage for resource **r** at time **t**. |
40
+ | **State: Jobs** | Tensor shape: **[num_jobs, n_resources, n_ticks]**. Each value ∈ **[0–1]** representing job resource demand for resource **r** at time **t**. |
41
+ | **Actions** | Discrete integer: **0 … (num_machines × num_jobs) + 1**. |
42
+ | **Action 0** | Represents an interrupt or a time tick (advance to next timestamp). |
43
+ | **Action 1+** | Represents assigning job **j** to machine **m** (encoded according to environment mapping). |
44
+
45
+ <br>
46
+
47
+ **Dilation Operations:** assuming kernel size (in each dimension) is bigger than 1. By padding the input according to max zoom in possible the service can work for varying kernel sizes.
48
+ In addition, assume that use (in our case the DRL agent) can execute 3 operation with zoomingIn (going up one level -1) or zoomingOut (going out one level +1) or skipping to next timestamp,
49
+ notice that without executing real scheduling (when in last level and select a machine) can't stop and skip.
50
+ Our algorithm represent the state as ndarray of `shape` to `[kernel_x, kernel_y, *shape[1:]]`. <br>
51
+
52
+ **Reward Functions:** for now the only reward function is +1 for scheduling job and changing the job status from pending into running.
53
+
54
+
55
+ Change Log
56
+ -----
57
+ EMPTY
58
+
59
+ Tasks:
60
+ -----
61
+
62
+ #### Important:
63
+
64
+ - [-] Create Dilation Gym Environment Wrapper `DilationWrapper`.
65
+ - [ ] Test `DilationWrapper`.
66
+ - [ ] Implement Render technics to represent and visualize cluster result
67
+ - [ ] Implement different reward Wrapper:
68
+ - [ ] Need to decide which one ??
69
+
70
+
71
+ #### Side Note:
72
+
73
+ - [ ] Create Dilation for DeepRM
74
+ - [ ] Create Tests for DeepRM
75
+
76
+
77
+ Finished Tasks:
78
+ -----
79
+ - [X] Implement global machine Protocol (`Machine`,`MachineCollection`).
80
+ - [X] Implement global job Protocol (`Job`,`JobCollection`).
81
+ - [X] Implement abstract cluster using these protocols, for Cross-functional (`ClusterABC`), where each subclass implement the creation of jobs and machines.
82
+ - [X] Test `ClusterABC` (property based).
83
+ - [X] Implement Single slot cluster using the abstract class (`SingleSlotCluster`).
84
+ - [X] Test `SingleSlotCluster` (property based).
85
+ - [X] Implement DeepRM cluster using the abstract class (`DeepRMCluster`).
86
+ - [X] Test `DeepRMCluster` (property based).
87
+ - [X] Implement MetricBased cluster using the abstract class (`MetricCluster`).
88
+ - [X] Test `MetricCluster` (property based).
89
+ - [X] Implement Gym Environment that get cluster as dependency `BasicClusterEnv`.
90
+ - [X] Test `BasicClusterEnv` (property based) using random scheduler (`RandomScheduler`).
91
+ - [X] Implement Dilation Protocol `DilationProtocol`.
92
+ - [X] Implement Dilation numpy functionality (`hierarchical_pooling`, `get_window_from_cell`, etc..) `array_operation.py`.
93
+ - [X] Test Dilation numpy functionality.
94
+ - [X] Implement Dilation Service for Metric based cluster `MetricBasedDilator`.
95
+ - [X] Test Dilation `MetricBasedDilator`.
96
+
97
+ ## Assumption
98
+ - Dilation assume that cluster state is bigger than dilation & the kernel has no 1 in each of its diminution
99
+ - For each Step which is not real allocation reward is set to 0
100
+ - On each job has reward of 1 if change status to running
101
+ - Dilation is operating by taking [n_machine, n_resource, n_ticks] and
102
+ padding to perpetrate size of [max_x_kernl, max_y_kernel, n_resources, n_ticks]
103
+ - Dilation implement both zoom in and zoom out when arriving to level 0 will cause real scheduling
@@ -0,0 +1,19 @@
1
+ [X] Integrate existing rendering as Env Wrapper (basicEnv & DilatorEnv)
2
+ [X] Create The following Schedulers:
3
+ [X] First come, First Served
4
+ [X] Shortest Job First
5
+ [X] Round Robin
6
+
7
+ [ ] Update project to be regular GymPackage
8
+ [X] Implement gym project layout
9
+ [ ] Test The new layout with
10
+ [ ] Fix error of s `non-deterministic as the observations are not equivalent`.
11
+ [ ] upload as python package to pip
12
+ [ ] Try to use this as gym env with some actions
13
+
14
+ [ ] Create simple pipeline including tianshou & wandb
15
+ [ ] Implement different reward functions ???
16
+ [ ] Train Simple model on Classic Env
17
+ [ ] Compare The result to regular scheduler
18
+ [ ] Take the existing model and run in on large env using Dilation and compare the results
19
+ [ ] If the results are bad need to add more features (reduce functions) accept max and min