{"id":22147894,"url":"https://github.com/dev0guy/clusterschedulingenv","last_synced_at":"2026-02-11T19:35:13.067Z","repository":{"id":263126800,"uuid":"885401075","full_name":"dev0Guy/ClusterSchedulingEnv","owner":"dev0Guy","description":"ClusterSchedulingEnv is a Gymnasium-compatible reinforcement learning environment designed to simulate complex cluster scheduling scenarios. It provides a robust framework for developing and testing reinforcement learning agents in environments where resource management, scheduling, and optimization are critical.","archived":false,"fork":false,"pushed_at":"2024-11-16T14:13:41.000Z","size":358,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-10T22:24:01.532Z","etag":null,"topics":["gymnasium","scheduling-simulator"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dev0Guy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-08T14:12:33.000Z","updated_at":"2025-03-23T11:59:51.000Z","dependencies_parsed_at":"2024-11-16T15:19:41.190Z","dependency_job_id":null,"html_url":"https://github.com/dev0Guy/ClusterSchedulingEnv","commit_stats":null,"previous_names":["dev0guy/drl","dev0guy/clusterschedulingenv"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dev0Guy/ClusterSchedulingEnv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev0Guy%2FClusterSchedulingEnv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev0Guy%2FClusterSchedulingEnv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev0Guy%2FClusterSchedulingEnv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev0Guy%2FClusterSchedulingEnv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dev0Guy","download_url":"https://codeload.github.com/dev0Guy/ClusterSchedulingEnv/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev0Guy%2FClusterSchedulingEnv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29342123,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T18:58:20.535Z","status":"ssl_error","status_checked_at":"2026-02-11T18:56:44.814Z","response_time":97,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gymnasium","scheduling-simulator"],"created_at":"2024-12-01T23:24:55.741Z","updated_at":"2026-02-11T19:35:13.049Z","avatar_url":"https://github.com/dev0Guy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cluster Environment Gym\n\nThe `ClusterEnv` environment is a simulation of a cluster system designed to manage the scheduling and allocation of jobs \non machines with limited resources. It is built using the `gymnasium` library and supports custom configurations for jobs, machines, and resources.\n\n\n## Wrappers\n\n### Observation Wrapper\n\n#### CombineMachinJobWrapper\nThe wrapper combines two separate observation components, jobs and machines, into a single unified observation space. \n\n### Action Wrapper\n\n#### DiscreteActionWrapper\nThe wrapper simplifies the action space by converting it into a discrete set of actions, \nenabling agents to operate within a simpler action space. Here’s a detailed breakdown of its functionality:\nIn the ClusterEnv, the default action space may involve complex multi-dimensional actions, such as specifying machine-job pairings or time management commands. This wrapper:\n1.\tConverts the action space into a discrete space of size  `(J * M + 1)`: \n     - additional action represents a “skip time” operation.\n     - The remaining actions represent all possible combinations of jobs and machines.\n2.\tTransforms a discrete action into a corresponding multi-dimensional action understandable by the ClusterEnv\n### Reward Wrapper\n\n#### AverageSlowDownReward\ncustom Gymnasium RewardWrapper for the ClusterEnv environment that penalizes the agent based on the average slowdown of pending jobs. \nIt tracks the number of ticks that each job remains in the Pending state, incrementing a slowdown counter for such jobs at each clock tick. \nThe reward is calculated as the negative sum of the inverse of the slowdown values for all pending jobs, incentivizing the agent to prioritize reducing job slowdowns. \nThis wrapper promotes efficient job scheduling by penalizing prolonged delays in job execution.\n```math\nS_i = S_i + \\mathbb{1}_{\\text{Pending}, i}(t)\n```\n```math\nR(t) = -\\sum_{i=1}^N \\frac{1}{S_i} \\quad \\text{where } S_i \u003e 0\n```\n\n### Env Wrapper\n\n#### ScheduleFromSelectedTimeWrapper\nThe wrapper customizes job scheduling in the ClusterEnv by dynamically validating and scheduling jobs based on resource availability\nand arrival times. It ensures jobs are scheduled only if sufficient resources are available on the target machine for \nthe required duration using a sliding window approach. The wrapper updates machine resource states upon successful scheduling, preventing\nover-allocation or invalid assignments. This ensures efficient resource utilization and supports dynamic scheduling in resource-constrained environments.\n\n#### QueueWrapper\nThe wrapper modifies the ClusterEnv to focus on a subset of jobs (queue_size), sorting them by status and dynamically updating their order based \non priority (e.g., pending jobs). It adjusts the action space to reference only the selected subset of jobs and remaps \njob indices in actions accordingly. The observation space is modified to include only the top queue_size jobs and their statuses, ensuring that the agent operates on the most relevant subset.\nThis wrapper streamlines decision-making by reducing complexity while prioritizing pending jobs for scheduling.\n\n\n## Extra Information\n\n### Notations:\n-   **J** : Number of jobs\n-   **R:** Number of resources\n-   **T:** Number of ticks\n-   **A:** Job arrival rate \n\n### Observation space\nThe environment provides the following observation:\n-   Machines: Free space per resource over time. Shape: `(M, R, T)`\n-   Jobs: Resource utilization demands over time. Shape: `(J, R, T)`\n-   Status: Current state of each job `(Not Created, Pending, Running, Completed)`. Shape: `(J)`\n\n### Action space\nconsist of gym.spaces.MultiDiscrete of `[TickActionOptions, M, J]` \u003c/br\u003e\nwhere `TickActionOptions`: \u003c/br\u003e\n`0` - No time increment \u003c/br\u003e\n`1` - Increment time\n\n### Job Generation Process\n\n**The following describes the mathematical process used to generate jobs**\n1. **Job Arrival Times -** \u003c/br\u003e\nJob arrival times are modeled as a Bernoulli process:\n```math\nT_{\\text{enter}, i} = \\sum_{j=1}^{i} B_j, \\quad B_j \\sim \\text{Bernoulli}(p)\n```\n\n2. **Job Durations -** \u003c/br\u003e\nJob durations are sampled from a mixture of two uniform distributions:\n```math\nD_i = \n\\begin{cases} \n\\text{Uniform}(1, 3), \u0026 \\text{if } U_i \u003c 0.8 \\\\\n\\text{Uniform}(10, 15), \u0026 \\text{otherwise}\n\\end{cases}\n\\quad \\text{where} \\quad U_i \\sim \\text{Uniform}(0, 1)\n```\n\n3.  **Resource Demands -** \u003c/br\u003e\nEach job (i) is assigned resource demands based on its dominant resource:\n```math\nR_{i,k} =\n\\begin{cases} \n\\text{Uniform}(127.5, 255), \u0026 \\text{if } k = R_{\\text{dom}, i} \\\\\n\\text{Uniform}(25.5, 51), \u0026 \\text{if } k \\neq R_{\\text{dom}, i}\n\\end{cases}\n\\quad \\text{where} \\quad R_{\\text{dom}, i} \\sim \\text{Uniform}\\{0, \\text{R}-1\\}\n```\n\n4. **Job Activity Over Time -** \u003c/br\u003e\nJobs are active based on their arrival times and durations:\n```math\nA_{i,t} =\n\\begin{cases}\n1, \u0026 \\text{if } T_{\\text{enter}, i} \\leq t \u003c T_{\\text{enter}, i} + D_i \\\\\n0, \u0026 \\text{otherwise}\n\\end{cases}\n```\n\n5. **Final Resource Utilization-** \u003c/br\u003e\nThe 3D array representing job resource utilization is calculated as:\n```math\nJ_{i,k,t} = A_{i,t} \\cdot R_{i,k}\nJ_{i,k,t} = A_{i,t} \\cdot R_{i,k}\n```\n\n### Machines Generation Process\nEach machine is reset with 255.0 of shape `(J,R,T)`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdev0guy%2Fclusterschedulingenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdev0guy%2Fclusterschedulingenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdev0guy%2Fclusterschedulingenv/lists"}