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

use result files for deployment #263

Merged
merged 10 commits into from
Mar 27, 2024

Conversation

trz42
Copy link
Contributor

@trz42 trz42 commented Mar 14, 2024

This is a long awaited PR for making the bot more agnostic to what it builds for. Specifically this removes code in the deployment procedure that was only correct for deploying tarballs created by build jobs for the (EESSI) software-layer.

It contains necessary changes in the logic but also some improvements to reduce boiler-plate code (handling/reading of information from ini/cfg-type files) and some renaming of variables, functions and log messages.

Below is a breakdown of the major changes

  • file tasks/deploy.py

    • uses get_section_from_file (tools/job_metadata.py) to read job metadata and return PR
      section
    • renames function determine_eessi_tarballs to determine_artefacts
      • uses _bot_jobSLURM_JOBID.result file to obtain list of artefacts (previously named tarballs)
      • it relies on what the script bot/check-build.sh in the target GitHub
        repository determines as artefacts, thus it does need to know anything about
        the target GitHub repository
    • renames function check_build_status to check_job_status
      • completely overhauled logic which essentially relies on the value of the
        attribute status in the _bot_jobSLURM_JOBID.result file
      • it relies on what the script bot/check-build.sh in the target GitHub
        repository determines as status, thus it does need to know anything about
        the target GitHub repository
    • renames function upload_tarball to upload_artefact
      • no changes of logic
      • mostly renamed 'tarball' to 'artefact' (except for tarball_prefix* related
        variables; these might be changed in a later PR; a change would also require
        changes to the configurations of bot instances, app.cfg.example and README.md)
      • also changed 'build_target' to 'payload' and made clear that
        'eessi-VERSION-COMPONENT-OS-ARCH' is just a format used within EESSI to
        describe the contents of a 'payload' (or 'build_target')
    • updates function uploaded_before
      • no changes of logic
      • uses 'payload' instead of 'build_target'
    • updates function determine_successful_jobs
      • removes unnecessary function calls: determine_slurm_out
      • removes unnecessary key/value pair in job dictionary: 'slurm_out'
      • switches to using 'artefact' instead of 'eessi_tarball' for variables and
        functions (determine_artefacts)
      • uses renamed and overhauled function check_job_status
      • minor polishing of log messages: 'build' $\rightarrow$ 'job'
    • renames function determine_tarballs_to_deploy to determine_artefacts_to_deploy
      • removes mentioning of 'slurm_out' data in job dictionary (docstring)
      • rephrases 'build*target' to 'payload' (docstring)
      • rephrases '(built/eessi) tarballs' to 'artefacts' (docstring, variables, log
        messages)
      • renames 'tb0' to 'artefact'
    • updates function deploy_built_artefacts
      • uses renamed function determine_artefacts_to_deploy instead of determine_tarballs_to_deploy
      • rephrases 'target' to 'payload'
      • uses renamed function upload_artefact instead of upload_tarball
  • file tools/job_metadata.py

    • defines a number of constant strings (to be used in tasks/deploy.py)
    • defines a new function determine_job_id_from_job_directory
    • defines a new function get_section_from_file
    • removes function read_job_metadata_from_file (calls to be replaced by
      get_section_from_file)
    • add constant for 'TEST' section
  • file eessi_bot_job_manager.py

    • replace functions read_job_metadata_from_file, read_job_test and read_job_result with function get_section_from_file
    • some polishing: changing imports, removing unused functions, removing unused constants
  • file tests/test_tools_job_metadata.py

    • replaced function read_job_metadata_from_file with function get_section_from_file
    • updated log file name accordingly
  • files README.md, app.cfg.example, scripts/eessi-upload-to-staging, tasks/deploy.py and tests/test_app.cfg

    • replaced tarball with artefact and TARBALL with ARTEFACT, respectively (wherever it makes sense $\rightarrow$ there is still some use of tarball where it makes sense)
  • files README.md, app.cfg.example and tests/test_app.cfg

    • removed unused config settings related to messages that were added to a PR comment when a job had finished
    • those messages are now created by some bot/check-build.sh script in the target repository of a pull request and the bot does not need to know anything about those specific messages ... it just prints whatever the bot/check-build.sh script generates

TODOs

truib added 2 commits March 14, 2024 23:58
- defines a number of constant strings (to be used in tasks/deploy.py)
- defines a new function determine_job_id_from_job_directory
- defines a new function get_section_from_file
- removes function read_job_metadata_from_file (calls to be replaced by
  get_section_from_file)
- includes numerous related changes
- uses job_metadata.get_section_from_file to read job metadata and return PR
  section
- renames determine_eessi_tarballs to determine_artefacts
  - uses _bot_jobSLURM_JOBID.result file to obtain artefacts
  - it relies on what the script bot/check-build.sh in the target GitHub
    repository determines as artefacts, thus it does need to know anything about
    the target GitHub repository
- renames check_build_status to check_job_status
  - completely overhauled logic which essentially relies on the value of the
    status attribute in the _bot_jobSLURM_JOBID.result file
  - it relies on what the script bot/check-build.sh in the target GitHub
    repository determines as status, thus it does need to know anything about
    the target GitHub repository
- renames upload_tarball to upload_artefact
  - no changes of logic
  - mostly renamed 'tarball' to 'artefact' (except for tarball_prefix* related
    variables; these might be changed in a later PR; a change would also require
    changes to the configurations, app.cfg.example and README.md)
  - also changed 'build_target' to 'payload' and made clear that
    'eessi-VERSION-COMPONENT-OS-ARCH' is just format used within EESSI to
    describe the contents of a payload (or build_target)
- updated uploaded_before
  - no changes of logic
  - uses 'payload' instead of 'build_target'
- updated determine_successful_jobs
  - removes unnecessary function calls: determine_slurm_out
  - removes unnecessary key/value pair in job dictionary: 'slurm_out'
  - switches to using 'artefact' instead of 'eessi_tarball' for variables and
    functions (determine_artefacts)
  - uses renamed and overhauled check_job_status
  - minor polishing of log messages: 'build' -> 'job'
- renames determine_tarballs_to_deploy to determine_artefacts_to_deploy
  - removes mentioning of 'slurm_out' data in job dictionary (docstring)
  - rephrases 'build*target' to 'payload' (docstring)
  - rephrases '(built/eessi) tarballs' to 'artefacts' (docstring, variables, log
    messages)
  - renames 'tb0' to 'artefact'
- updated deploy_built_artefacts
  - uses determine_artefacts_to_deploy instead of determine_tarballs_to_deploy
  - rephrases 'target' to 'payload'
  - uses upload_artefact instead of upload_tarball
@trz42 trz42 marked this pull request as draft March 15, 2024 00:02
truib added 3 commits March 15, 2024 12:42
- file 'tools/job_metadata.py'
  - add constant for 'TEST' section

- file 'eessi_bot_job_manager.py'
  - replace read_job_metadata_from_file, read_job_test and read_job_result with get_section_from_file
  - some polishing: changing imports, removing unused functions

- file 'tests/test_tools_job_metadata.py'
  - replaced read_job_metadata_from_file with get_section_from_file
  - updated log file name accordingly
@trz42 trz42 marked this pull request as ready for review March 21, 2024 08:50
tasks/deploy.py Outdated Show resolved Hide resolved
tasks/deploy.py Outdated Show resolved Hide resolved
eessi_bot_job_manager.py Show resolved Hide resolved
Copy link
Collaborator

@laraPPr laraPPr left a comment

Choose a reason for hiding this comment

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

lgtm

@laraPPr laraPPr merged commit 9d924c5 into EESSI:develop Mar 27, 2024
7 checks passed
@trz42 trz42 mentioned this pull request May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants