Skip to content
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

CI: Set runners to ubuntu-24.04 #6696

Merged
merged 5 commits into from
Jan 15, 2025
Merged

Conversation

danielhollas
Copy link
Collaborator

GitHub is rolling out a change where ubuntu-latest will start to point to ubuntu-24.04.

@unkcpz
Copy link
Member

unkcpz commented Jan 12, 2025

The failed tests are introduced by #6584 not too long ago. @GeigerJ2 can you have a look?

FAILED tests/orm/nodes/data/test_remote.py::test_get_size_on_disk_params[setup0-results0-local] - AssertionError: assert ('12.00 B', 'du') == ('4.01 KB', 'du')
  At index 0 diff: '12.00 B' != '4.01 KB'
  Full diff:
  - ('4.01 KB', 'du')
  ?   ^  ^^^
  + ('12.00 B', 'du')
  ?   ^^  ^^
FAILED tests/orm/nodes/data/test_remote.py::test_get_size_on_disk_params[setup0-results0-ssh] - AssertionError: assert ('12.00 B', 'du') == ('4.01 KB', 'du')
  At index 0 diff: '12.00 B' != '4.01 KB'
  Full diff:
  - ('4.01 KB', 'du')
  ?   ^  ^^^
  + ('12.00 B', 'du')
  ?   ^^  ^^

It also failed on my laptop after I update the linux kernel (6.12.7-arch1-1), I guess it is because the changed output of du command?

@GeigerJ2
Copy link
Contributor

Thanks for the ping, @unkcpz. Will have a look!

@GeigerJ2
Copy link
Contributor

I knew these tests were rather fragile, but I didn't expect them to fail that quickly 🥲 Can confirm that the behavior of du -s --bytes is somehow different between the two Ubuntu versions.

Ubuntu 22.04 (WSL)
image

Ubuntu 24.04 (WSL)
image

@unkcpz
Copy link
Member

unkcpz commented Jan 13, 2025

No worries, I know it is hard to test things cross command line interface to transport to final remote system call. This one is also not easy to mock and test (it can but would be a bit meaningless IMO).
Is there ways to add more options to du to make the output more predictable? Otherwise, you probably need to add a version check for remote du, which is also not ideal.

@GeigerJ2
Copy link
Contributor

@unkcpz the issue should be fixed by #6702 (I hope, CI still running, fingers crossed :D). Was actually not too difficult to trace it back, as I could just set up a minimal Ubuntu 24.04 via WSL and go from there. du not giving predictable output with the --bytes option was exactly the issue... should be fine now.

Going back to the original purpose of the PR, @danielhollas, thanks for the change! I think it's indeed better to be explicit. I'd say once #6702 is merged, this can be rebased, and merged as well (I also applied the change of this PR in my latest commit, to see if it works, but will revert that again before merge).

GeigerJ2 added a commit that referenced this pull request Jan 13, 2025
In #6584 the `get_size_on_disk` method was added to `RemoteData`, which calls the `du` utility as the default way to obtain the size of an associated file/directory, using the `-s` (summary) and `--bytes` options. As discovered in #6696, however, the relevant tests started failing when the `ubuntu-latest` environment of GHA got updated to point to Ubuntu 24.04 instead of 22.04. This is because, as it turns out, `--bytes` does not only give the output in bytes, but is actually equivalent to `--apparent-size`, as well as `--block-size=1`, and the behavior of the `--apparent-size` option of `du` has changed between the different Ubuntu versions. Thus, the command is now changed from `du -s --bytes` to `du -s --block-size=1`, as to still obtain the total size in bytes, but make the results more reliable and less fragile by not reporting the apparent size. The size results for the various parametrized test cases have also been updated accordingly.
Copy link

codecov bot commented Jan 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.99%. Comparing base (199a027) to head (9822340).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6696   +/-   ##
=======================================
  Coverage   77.99%   77.99%           
=======================================
  Files         563      563           
  Lines       41762    41762           
=======================================
  Hits        32570    32570           
  Misses       9192     9192           

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

@danielhollas danielhollas changed the title CI: Set runners ubuntu-24.04 CI: Set runners to ubuntu-24.04 Jan 14, 2025
@danielhollas
Copy link
Collaborator Author

danielhollas commented Jan 14, 2025

Hmm, the nightly tests are failing with Ubuntu 24.04, specifically this invocation

verdi -p test_aiida run ${SYSTEM_TESTS}/test_containerized_code.py

fails with (note specifically the first line)

Warning: output parser returned exit code<320>: The output file contains invalid output.
Traceback (most recent call last):
  File "/home/runner/work/aiida-core/aiida-core/./.venv/bin/verdi", line 8, in <module>
results={'remote_folder': <RemoteData: uuid: 17a41a65-3d01-4a9c-8388-891a433de295 (pk: 411)>, 'retrieved': <FolderData: uuid: d4d9581e-d4b1-44c3-b1e7-1e9e270dcfc5 (pk: 412)>}
    sys.exit(verdi())
             ^^^^^^^
  File "/home/runner/work/aiida-core/aiida-core/.venv/lib/python3.11/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/aiida-core/aiida-core/.venv/lib/python3.11/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/runner/work/aiida-core/aiida-core/.venv/lib/python3.11/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/aiida-core/aiida-core/src/aiida/cmdline/groups/verdi.py", line 117, in invoke
node=<CalcJobNode: uuid: 196e05f7-f0df-4fda-842f-ba700194d8ee (pk: 410) (aiida.calculations:core.arithmetic.add)>
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/aiida-core/aiida-core/.venv/lib/python3.11/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/aiida-core/aiida-core/src/aiida/cmdline/utils/decorators.py", line 104, in wrapper
    return wrapped(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/aiida-core/aiida-core/src/aiida/cmdline/commands/cmd_run.py", line 120, in run
    exec(compile(handle.read(), str(filepath), 'exec', dont_inherit=True), globals_dict)
  File "/home/runner/work/aiida-core/aiida-core/.github/system_tests/test_containerized_code.py", line 39, in <module>
    main()
  File "/home/runner/work/aiida-core/aiida-core/.github/system_tests/test_containerized_code.py", line 35, in main
    test_add_singularity()
  File "/home/runner/work/aiida-core/aiida-core/.github/system_tests/test_containerized_code.py", line 27, in test_add_singularity
    assert node.is_finished_ok
           ^^^^^^^^^^^^^^^^^^^
AssertionError

I will not have time to dig into this further. For this PR I suggest to pin the nightly tests to ubuntu-22.04 and open an issue for a follow-up? WDYT @unkcpz @GeigerJ2

@danielhollas danielhollas marked this pull request as ready for review January 14, 2025 19:44
@unkcpz
Copy link
Member

unkcpz commented Jan 15, 2025

I will not have time to dig into this further. For this PR I suggest to pin the nightly tests to ubuntu-22.04 and open an issue for a follow-up?

I noticed it as well, but has no clue of what that happened. Yes, pinning it to ubuntu-22.04 can be a workaround, since it is now fail the tests of main branch anyway.

@danielhollas
Copy link
Collaborator Author

Yes, pinning it to ubuntu-22.04 can be a workaround, since it is now fail the tests of main branch anyway.

Okay, done. Assuming the tests will pass this should be good to merge.

Copy link
Member

@unkcpz unkcpz left a comment

Choose a reason for hiding this comment

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

@danielhollas thanks for the change!

@unkcpz unkcpz merged commit b432611 into aiidateam:main Jan 15, 2025
44 checks passed
@danielhollas danielhollas deleted the ubuntu-24 branch January 15, 2025 17:11
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.

3 participants