Skip to content

Change project layout#9

Merged
dev0Guy merged 6 commits intomainfrom
change-project-layout
Mar 21, 2026
Merged

Change project layout#9
dev0Guy merged 6 commits intomainfrom
change-project-layout

Conversation

@dev0Guy
Copy link
Copy Markdown
Owner

@dev0Guy dev0Guy commented Mar 21, 2026

Summary by Sourcery

Restructure the cluster simulator and scheduler modules under the new server_simulator package and update all imports accordingly.

Enhancements:

  • Move cluster_simulator envs, wrappers, and scheduler modules into the server_simulator namespace to reflect the new project layout.
  • Update internal references, renderers, and wrappers to use the new server_simulator.envs paths for cluster simulation components.

Tests:

  • Adjust test imports and strategies to target the relocated server_simulator modules while preserving existing e2e and unit test coverage.

Chores:

  • Update IDE/project configuration files to align with the new server_simulator module structure.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Mar 21, 2026

Reviewer's Guide

Refactors the project layout by moving the cluster simulator, schedulers, wrappers, and related tests under a new src.server_simulator package namespace, updating all internal imports and references to match the new structure and keeping behavior unchanged.

File-Level Changes

Change Details Files
Move cluster simulator environment code into the new server_simulator package and update internal imports.
  • Relocate envs/cluster_simulator modules (basic, deep_rm, metric_based, single_slot, base components, utils) under src/server_simulator/envs/cluster_simulator.
  • Adjust all intra-env imports to use src.server_simulator.envs.cluster_simulator.* instead of src.envs.cluster_simulator.*.
  • Ensure observation, information, reward, cluster, actions, and renderer modules reference the new ClusterABC, Job/Machine collections, and other shared types via the new package path.
src/server_simulator/envs/__init__.py
src/server_simulator/envs/cluster_simulator/basic.py
src/server_simulator/envs/cluster_simulator/actions.py
src/server_simulator/envs/cluster_simulator/base/internal/cluster.py
src/server_simulator/envs/cluster_simulator/base/internal/job.py
src/server_simulator/envs/cluster_simulator/base/internal/machine.py
src/server_simulator/envs/cluster_simulator/base/extractors/observation.py
src/server_simulator/envs/cluster_simulator/base/extractors/information.py
src/server_simulator/envs/cluster_simulator/base/extractors/reward.py
src/server_simulator/envs/cluster_simulator/base/renderer.py
src/server_simulator/envs/cluster_simulator/deep_rm/__init__.py
src/server_simulator/envs/cluster_simulator/deep_rm/internal/jobs.py
src/server_simulator/envs/cluster_simulator/deep_rm/internal/machines.py
src/server_simulator/envs/cluster_simulator/deep_rm/observation.py
src/server_simulator/envs/cluster_simulator/deep_rm/creator.py
src/server_simulator/envs/cluster_simulator/metric_based/__init__.py
src/server_simulator/envs/cluster_simulator/metric_based/creator.py
src/server_simulator/envs/cluster_simulator/metric_based/internal/dilation.py
src/server_simulator/envs/cluster_simulator/metric_based/internal/jobs.py
src/server_simulator/envs/cluster_simulator/metric_based/internal/machines.py
src/server_simulator/envs/cluster_simulator/metric_based/observation.py
src/server_simulator/envs/cluster_simulator/metric_based/renderer.py
src/server_simulator/envs/cluster_simulator/single_slot/__init__.py
src/server_simulator/envs/cluster_simulator/single_slot/creator.py
src/server_simulator/envs/cluster_simulator/single_slot/internal/jobs.py
src/server_simulator/envs/cluster_simulator/single_slot/internal/machines.py
src/server_simulator/envs/cluster_simulator/single_slot/observation.py
Move wrappers into server_simulator namespace and update their dependencies.
  • Relocate cluster_simulator wrappers (dilation_wrapper, render_wrapper) under src/server_simulator/wrappers/cluster_simulator.
  • Update wrapper imports to reference BasicClusterEnv, EnvironmentAction, DilationEnvironmentAction, BaseClusterObservation, ClusterInformation, RenderMode, and dilation internals from src.server_simulator.envs.* instead of src.envs.*.
src/server_simulator/wrappers/cluster_simulator/dilation_wrapper.py
src/server_simulator/wrappers/cluster_simulator/render_wrapper.py
Move scheduler implementations under server_simulator and rewire imports.
  • Relocate base_scheduler and concrete scheduler implementations (first_come_first_served, random, round_robin, shortest_job_first) under src/server_simulator/scheduler.
  • Update scheduler imports to use src.server_simulator.envs.cluster_simulator.base.internal.job/machine for JobCollection and MachineCollection types, and update intra-scheduler imports to the new package path.
src/server_simulator/scheduler/base_scheduler.py
src/server_simulator/scheduler/first_come_first_served_scheduler.py
src/server_simulator/scheduler/random_scheduler.py
src/server_simulator/scheduler/round_robin_scheduler.py
src/server_simulator/scheduler/shortest_job_first_scheduler.py
Update tests and Hypothesis strategies to import from the new server_simulator package layout.
  • Change test imports from src.envs.* and src.wrappers.* to src.server_simulator.envs.* and src.server_simulator.wrappers.* as appropriate.
  • Adjust e2e tests to import src.server_simulator.envs (or src.server_simulator) to register gym environments instead of src.envs.
  • Update strategy modules for clusters, envs, and dilation to reference AbstractDilation, ClusterABC, BaseObservationCreatorProtocol, and utils via the new server_simulator paths.
  • Perform a minor whitespace tweak in one strategy file with no behavioral impact.
tests/test_e2e/test_e2e_deeprm.py
tests/test_e2e/test_e2e_matric_based.py
tests/test_e2e/test_e2e_single_slot.py
tests/test_envs/test_cluster_simulator/test_utils/test_array_operations.py
tests/strategies/cluster_strategies/proto.py
tests/strategies/cluster_strategies/deeprm_st.py
tests/strategies/cluster_strategies/metric_st.py
tests/strategies/cluster_strategies/single_slot_st.py
tests/strategies/env_strategies/basic_env_st.py
tests/strategies/dilation_strategies/proto.py
tests/strategies/dilation_strategies/metric_cluster_dilator_st.py
tests/test_envs/test_basic_env.py
tests/test_envs/test_cluster_simulator/test_deep_rm/test_deeprm_cluster.py
tests/test_envs/test_cluster_simulator/test_metric_based/test_metric_cluster.py
tests/test_envs/test_cluster_simulator/test_metric_based/tests_metric_dilation.py
tests/test_envs/test_cluster_simulator/test_single_slot/test_single_slot_cluster.py
tests/test_envs/test_cluster_simulator/test_single_slot/utils.py
tests/test_wrappers/test_dilation_wrapper.py
Update PyCharm/IDEA project metadata to reflect the new layout.
  • Adjust .idea/misc.xml and module .iml file so the IDE recognizes the new server-simulator module structure.
.idea/misc.xml
.idea/server-simulator.iml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The test_e2e_single_slot.py change from from src import envs to import src.server_simulator is inconsistent with the other e2e tests (import src.server_simulator.envs) and may no longer trigger env registration as intended; consider importing the envs subpackage explicitly for side-effects.
  • In wrappers/cluster_simulator/render_wrapper.py, BaseClusterObservation is now imported from src.server_simulator.envs.cluster_simulator instead of the observation module; verify that the package’s __init__ exposes this symbol or restore the more direct module import to avoid accidental breakage.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `test_e2e_single_slot.py` change from `from src import envs` to `import src.server_simulator` is inconsistent with the other e2e tests (`import src.server_simulator.envs`) and may no longer trigger env registration as intended; consider importing the envs subpackage explicitly for side-effects.
- In `wrappers/cluster_simulator/render_wrapper.py`, `BaseClusterObservation` is now imported from `src.server_simulator.envs.cluster_simulator` instead of the observation module; verify that the package’s `__init__` exposes this symbol or restore the more direct module import to avoid accidental breakage.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@dev0Guy dev0Guy merged commit 10d9241 into main Mar 21, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant