Skip to content

Conversation

@germa89
Copy link
Collaborator

@germa89 germa89 commented Jun 25, 2025

Description

As the title.

Issue linked

Extracted from #1300

Checklist

Summary by Sourcery

Enhance CI infrastructure and scripts to improve logging, support DPF services for CICD MAPDL images, and streamline multi-instance testing workflows.

New Features:

  • Introduce conditional DPF port binding and support for DPF backend testing on CICD MAPDL images.

Enhancements:

  • Refactor start_mapdl.sh to dynamically build docker run commands and emit detailed logs.
  • Enhance waiting_services.sh and collect_mapdl_logs_remote.sh to group outputs and capture docker/process states.

CI:

  • Update test-remote.yml and test-local.yml workflows to launch dual MAPDL instances with distinct DPF ports, handle CICD-specific DPF startup, and prefix artifacts with remote-/local- tags.
  • Adjust DPF port environment variables and PyTest parameters in CI job matrices.

Chores:

  • Rename CI artifact filenames to include remote- and local- prefixes for clarity.

@germa89 germa89 requested a review from a team as a code owner June 25, 2025 11:45
@ansys-reviewer-bot
Copy link
Contributor

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jun 25, 2025

Reviewer's Guide

This PR refactors and enriches the CI infrastructure by overhauling the container startup script to support DPF reader modes and dynamic logging, updating GitHub Actions workflows to handle dual-instance and CICD‐specific DPF backends, and improving log collection and service‐waiting scripts with enhanced visibility.

Flow diagram for improved MAPDL container startup with DPF-reader support

flowchart TD
  ENV[Set environment variables]
  CHECK[Check if MAPDL_VERSION contains 'cicd']
  CICD{Is CICD version?}
  DPF[Bind DPF port and set DB_INT_PORT=50056]
  NODPF[Set DPF_ARG empty and DB_INT_PORT=50055]
  CMD[Build docker run command]
  RUN[Run docker container]
  LOG[Redirect output to INSTANCE_NAME.log]
  WAIT[Wait for 'Server listening on' in log]
  SHOW[Show log content]

  ENV --> CHECK --> CICD
  CICD -- Yes --> DPF --> CMD
  CICD -- No --> NODPF --> CMD
  CMD --> RUN --> LOG --> WAIT --> SHOW
Loading

Flow diagram for enhanced log collection in CI

flowchart TD
  START[Start log collection script]
  MKDIR[Create log directory]
  DOCKERDIR[Create /mapdl_logs in container]
  MVLOG[Move *.log files to /mapdl_logs]
  PROCESSES[Save ps aux to docker_processes_end.log]
  OUTERR[Move *.out and *.err files to /mapdl_logs]
  COPY[Copy /mapdl_logs to host]
  LOCAL[Collect local build logs]
  DOCKERPS[Save docker ps to docker_ps_end.log]
  MVLOCAL[Move all *.log files to log directory]
  PROF[Move profiling files]

  START --> MKDIR --> DOCKERDIR --> MVLOG --> PROCESSES --> OUTERR --> COPY --> LOCAL --> DOCKERPS --> MVLOCAL --> PROF
Loading

File-Level Changes

Change Details Files
Refactor and annotate the MAPDL startup script for dynamic command building and DPF support
  • Added detailed usage comments and required environment variables
  • Introduced logic to detect CICD versions and set DPF_ARG and DB_INT_PORT accordingly
  • Replaced inline docker run invocation with a generated CMD string and echo for debugging
  • Redirected container logs to instance‐named files and grepped for readiness
  • Dumped final log contents for postmortem inspection
.ci/start_mapdl.sh
Enhance GitHub workflows for DPF‐reader support and multi‐instance testing
  • Added secondary DPF_PORT2 and TEST_DPF_BACKEND flags for CICD versions
  • Updated pytest arguments to reduce maxfail threshold
  • Injected logic to set ON_SAME_CONTAINER when using CICD images
  • Launched a second MAPDL instance with its own ports for pool testing
  • Conditionally started DPF server inside the MAPDL container
  • Renamed output artifact file names with explicit "remote-"/"local-" prefixes
.github/workflows/test-remote.yml
.github/workflows/ci.yml
.github/workflows/test-local.yml
Improve remote log-collection script with comprehensive captures
  • Moved all .log files inside the container before copying
  • Captured container processes at end of run
  • Generalized log movement and directory listing
  • Removed hard-coded file moves in favor of glob patterns
.ci/collect_mapdl_logs_remote.sh
Augment service-wait script with grouped diagnostics
  • Added GitHub Actions log group annotations for docker ps and ps aux outputs
  • Streamlined wait loops with consistent formatting
  • Logged interim container status for easier debugging
.ci/waiting_services.sh

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
Contributor

@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 @germa89 - I've reviewed your changes - here's some feedback:

  • In start_mapdl.sh you removed the --health-cmd from the Docker invocation but kept the health-interval/timeout flags—re-add the health check command to ensure the container’s health is actually being probed.
  • In collect_mapdl_logs_remote.sh the line docker ps > /"$LOG_NAMES"/docker_ps_end.log uses a leading slash, causing logs to write under the root directory; drop the slash so it writes to the intended relative folder.
  • The *"cicd"* detection and TEST_DPF_BACKEND logic is duplicated in both test-remote.yml and test-local.yml—consider extracting it into a shared step or composite action to reduce repetition.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In start_mapdl.sh you removed the `--health-cmd` from the Docker invocation but kept the health-interval/timeout flags—re-add the health check command to ensure the container’s health is actually being probed.
- In collect_mapdl_logs_remote.sh the line `docker ps > /"$LOG_NAMES"/docker_ps_end.log` uses a leading slash, causing logs to write under the root directory; drop the slash so it writes to the intended relative folder.
- The `*"cicd"*` detection and TEST_DPF_BACKEND logic is duplicated in both test-remote.yml and test-local.yml—consider extracting it into a shared step or composite action to reduce repetition.

## Individual Comments

### Comment 1
<location> `.ci/collect_mapdl_logs_remote.sh:34` </location>
<code_context>
-echo "Collecting docker run log..."
-mv log.txt ./"$LOG_NAMES"/log.txt || echo "MAPDL run docker log not found."
-mv log_dpf.txt ./"$LOG_NAMES"/log_dpf.txt || echo "DPF run docker log not found."
+docker ps > /"$LOG_NAMES"/docker_ps_end.log || echo "Failed to print the docker ps"

-echo "Moving docker launch log..."
</code_context>

<issue_to_address>
The path '/"$LOG_NAMES"/docker_ps_end.log' may not resolve as intended due to the leading slash and quoting.

A leading slash creates an absolute path, which may not be writable or correct. Quoting $LOG_NAMES will include the quotes in the filename. Use './$LOG_NAMES/docker_ps_end.log' instead.
</issue_to_address>

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.

@github-actions github-actions bot added CI/CD Related with CICD, Github Actions, etc maintenance General maintenance of the repo (libraries, cicd, etc) new feature Request or proposal for a new feature labels Jun 25, 2025
@codecov
Copy link

codecov bot commented Jun 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.18%. Comparing base (fdbc9ad) to head (048794a).
Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4040   +/-   ##
=======================================
  Coverage   89.18%   89.18%           
=======================================
  Files         187      187           
  Lines       14993    14993           
=======================================
  Hits        13372    13372           
  Misses       1621     1621           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@germa89 germa89 self-assigned this Jun 25, 2025
@germa89
Copy link
Collaborator Author

germa89 commented Jun 26, 2025

@pyansys-ci-bot LGTM

@germa89 germa89 enabled auto-merge (squash) June 26, 2025 14:25
Copy link
Contributor

@pyansys-ci-bot pyansys-ci-bot left a comment

Choose a reason for hiding this comment

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

✅ Approving this PR because germa89 said so in here 😬

LGTM

@germa89 germa89 merged commit b671c74 into main Jun 27, 2025
48 checks passed
@germa89 germa89 deleted the ci/improving-infrastructure-for-future-DPF-reader-support branch June 27, 2025 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/CD Related with CICD, Github Actions, etc maintenance General maintenance of the repo (libraries, cicd, etc) new feature Request or proposal for a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants