Skip to content

Add unit and integration tests for Slurm #2233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Conversation

kinow
Copy link
Member

@kinow kinow commented Mar 18, 2025

Partially addresses #977

Temporary branch, that I will either update or delete in the next days.

@sergipalomas commented about an issue on how energy is reported by the API, but looking at AS code, it seems that AS is the one actually storing 0 in the energy column of job data.

BSC-ES/autosubmit-api#175 (comment)

I started writing a unit test for that, but I realized that the sacct output I have is missing some columns. I have jobs with energy consumption, but I'm interested in using Sergi's example to check if I can reproduce the case where energy=0 (then I can get that and write a test, and get another one that doesn't return 0, covering both -- this is, if we confirm that it is indeed 0 and not another value that should be returned).

@VindeeR & @isimo00 will also work on the Slurm platform soon for Maestro (#2165), and we will have to increase our test coverage for that module, so it'll be a win-win for all if we can get this test written and working.

@kinow kinow added this to the 4.1.13 milestone Mar 18, 2025
@kinow kinow self-assigned this Mar 18, 2025
15994954.1 2025-02-24T16:12:17 2025-02-24T16:12:17 2025-02-24T16:21:22 00:09:05 844.90K
''')
tuple_data = slurm_platform.parse_job_finish_data(output, packed=False)
assert tuple_data is not None
Copy link
Member Author

Choose a reason for hiding this comment

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

Note to self, get the correct output from Sergi, then update the string above, and continue writing the test to actually test something, not is not None 😬

Copy link
Collaborator

Choose a reason for hiding this comment

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

To push local changes

Copy link
Member Author

Choose a reason for hiding this comment

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

Huh, didn't find the code I had written on my laptop at home. Will take a look at my other BSC laptop next week 😰 (or will have to write the test again 😥 )

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 52.34%. Comparing base (42a6880) to head (25912d9).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2233      +/-   ##
==========================================
+ Coverage   52.10%   52.34%   +0.24%     
==========================================
  Files          71       71              
  Lines       17610    17617       +7     
  Branches     3416     3417       +1     
==========================================
+ Hits         9176     9222      +46     
+ Misses       7635     7590      -45     
- Partials      799      805       +6     
Flag Coverage Δ
fast-tests 52.34% <ø> (+0.24%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dbeltrankyl dbeltrankyl self-requested a review March 27, 2025 09:28
@kinow kinow modified the milestones: 4.1.13, 4.1.15 Apr 16, 2025
@dbeltrankyl
Copy link
Collaborator

I see this assigned to myself, but I also see that this is a draft .. so what is the real status of this one?

@kinow kinow removed the request for review from dbeltrankyl April 30, 2025 12:20
@kinow kinow force-pushed the add-some-slurm-tests branch from 25912d9 to 4e9d2b0 Compare April 30, 2025 12:21
@kinow kinow force-pushed the add-some-slurm-tests branch from 4e9d2b0 to d104867 Compare May 29, 2025 13:19
@kinow kinow changed the title WIP adding some tests for slurm platform Add unit and integration tests for Slurm May 29, 2025
@kinow
Copy link
Member Author

kinow commented May 29, 2025

@VindeeR I've added two integration tests. One creates an experiment and the Slurm platform object, and can be used to check the initial state of the Slurm object.

The other one is more interesting. If you modify the values for scratch dir (/gpfs/scratch), group (bsc32), and user (your user), and host to glogin?.bsc.es, the test should run fine against BSC MN5.

If your PR, #2362 works, we can just point the test to the Slurm container, and the GitHub Actions should then pass.

@kinow
Copy link
Member Author

kinow commented May 29, 2025

I will update the unit test that I wrote using performance data. I had written it in some branch, in some laptop, but I cannot find it 😅 So I will have to rewrite it tomorrow or over next days when I take a break from Postgres.

@kinow kinow moved this from Todo to In Progress in Autosubmit project May 29, 2025
@@ -153,20 +149,18 @@ def process_batch_ready_jobs(self, valid_packages_to_submit, failed_packages: li
except AutosubmitError as e:
job_names = []
duplicated_jobs_already_checked = True
try:
with suppress(Exception):
Copy link
Member Author

Choose a reason for hiding this comment

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

Besides suppress, nothing exciting to see here. Mainly fixing IDE/linter issues in comments, code, types, ...

})

exp.autosubmit._check_ownership_and_set_last_command(exp.as_conf, exp.expid, 'run')
assert 0 == exp.autosubmit.run_experiment(_EXPID)
Copy link
Member Author

Choose a reason for hiding this comment

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

Note to self: maybe add to AutosubmitExperiment a function run that does both, check ownership + run?



def _create_slurm_platform(as_conf: AutosubmitConfig):
return SlurmPlatform(_EXPID, _PLATFORM_NAME, config=as_conf.experiment_data, auth_password=None)
Copy link
Member Author

Choose a reason for hiding this comment

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

Note to self: We should create the platform dictionary here, so it's not repeated in each test; the problem is that we may have to call as_conf.save(), or sort out what's called first... I tried it today and got the wrong data saved to disk.

@dbeltrankyl dbeltrankyl modified the milestones: 4.1.15, 4.1.16 Jun 5, 2025
@kinow
Copy link
Member Author

kinow commented Jun 25, 2025

@VindeeR I think if you can copy the unit tests from this branch into yours, #2362 , then we can close this as superseded by your PR.

VindeeR added a commit that referenced this pull request Jun 25, 2025
VindeeR added a commit that referenced this pull request Jun 26, 2025
# This is the 1st commit message:

build a slurm container where itll replicate the systems behaviour allowing for more complex testing of the autosubmit tool facilitating the addition of coverage to the report file ensuring quality of the code

# The commit message #2 will be skipped:

# adding changes introduced by @kinow at the PR #2233

# The commit message #3 will be skipped:

# adding extra testing to bump up the coverage of the slurm

# The commit message #4 will be skipped:

# f
@kinow kinow removed the status in Autosubmit project Jun 26, 2025
@kinow kinow added the wontfix This will not be worked on label Jun 26, 2025
@kinow kinow added the wontfix This will not be worked on label Jun 26, 2025
@kinow
Copy link
Member Author

kinow commented Jun 26, 2025

Superseded by #2362, thanks @manuel-g-castro & @VindeeR for the work on the image, GH Actions & tests ! ⭐

@kinow kinow closed this Jun 26, 2025
@kinow kinow deleted the add-some-slurm-tests branch July 8, 2025 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants