Skip to content

[com4]: allow executing FlowPy from a different repo with cfg overwrite - #1298

Merged
PaulaSp3 merged 1 commit into
masterfrom
PS_FP_changeCfgRead
Jul 23, 2026
Merged

[com4]: allow executing FlowPy from a different repo with cfg overwrite#1298
PaulaSp3 merged 1 commit into
masterfrom
PS_FP_changeCfgRead

Conversation

@PaulaSp3

@PaulaSp3 PaulaSp3 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

update:

  • the return of the runCom4FlowPy.main() function is a dictionary containing:

    • "uid": id of simulation
    • "simulation": boolean: is the simulation is run
    • "resultOverwritten": boolean: are result files overwritten
    • "message": explanation to simulation status
  • a simulation is executed, when there are no files in the results folder (with the same uid as the simulation that should be done)

  • a flag overwriteResults is added,

    • if it is True result files are created although they already exist with same uid
    • (now, the file name contains the time stamp of the simulation, so the new result files do not overwrite the existing, they are added; do we want that or overwriting them? -> e.g. with deleting the timestamp in the file name or deleting the already existing result folder, and creating a new one within the simulation)
  • added test

PR Checklist

Please confirm before requesting review:

  • I ran pytest locally without fails
  • I added/updated tests where needed
  • I updated documentation where needed

Confirm before the final merge/rebase into master

  • Commits are sensibly squashed and rebased onto latest master
  • Standardtest run without difference (with recompiled cython code)

@PaulaSp3
PaulaSp3 requested a review from ahuber-bfw June 22, 2026 15:26
@PaulaSp3 PaulaSp3 self-assigned this Jun 22, 2026
@PaulaSp3 PaulaSp3 added the flowPyDev Ideas for future development label Jun 22, 2026
@qltysh

qltysh Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Qlty


Coverage Impact

⬆️ Merging this pull request will increase total coverage on master by 3.20%.

Modified Files with Diff Coverage (2)

RatingFile% DiffUncovered Line #s
Coverage rating: B Coverage rating: B
avaframe/in3Utils/fileHandlerUtils.py100.0%
Coverage rating: F Coverage rating: F
avaframe/com4FlowPy/com4FlowPy.py0.0%424-796
Total94.7%
🤖 Increase coverage with AI coding...
In the `PS_FP_changeCfgRead` branch, add test coverage for this new code:

- `avaframe/com4FlowPy/com4FlowPy.py` -- Line 424-796

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@ahuber-bfw ahuber-bfw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good addition - should work as a quick hack and not break any current usage of the script.

For a more permanent solution I would suggest at least to address the following points:

  • instead of just returning uid at every exit point of the function we can return sth. like a named tuple or dictionary with the uid and a function exit status, that lets the caller know if the function executed com4FlowPy successfully or did not run the model - because input was incorrect, result folders already exist --> see extra comment below
  • write a small test that confirms the expected behavior of the functionality for different scenarios

in addition we could use this to think about how we want to handle the situation of already existing results with the same uid, which is currently also not solved well. Maybe we could:

  • add an additional check, that also looks if the existing result folder with the uid is populated with valid resultFiles instead of just checking if the folder already exists (now this could also result from a previously started, but aborted model run) --> this would fix Issue #1135
  • add an additional function parameter overwrite where the user can specify e.g. default --> don't run simulation if results with same uid already there; overwrite if sims should be performed any way

Comment thread avaframe/runCom4FlowPy.py
Comment thread avaframe/runCom4FlowPy.py Outdated
@PaulaSp3
PaulaSp3 force-pushed the PS_FP_changeCfgRead branch 2 times, most recently from 6bdcf91 to 52f01ef Compare July 6, 2026 14:47
@PaulaSp3 PaulaSp3 linked an issue Jul 6, 2026 that may be closed by this pull request

@ahuber-bfw ahuber-bfw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tests schauen gut aus - dictionary als return passt auch.

  • die Kommentare in runCom4FlowPy.py bitte noch anpassen
  • der comment im .ini file ist als Diskussionspunkt gedacht (was meinst du?)

Comment thread avaframe/runCom4FlowPy.py Outdated
Comment thread avaframe/runCom4FlowPy.py Outdated
Comment thread avaframe/runCom4FlowPy.py Outdated
Comment thread avaframe/com4FlowPy/com4FlowPyCfg.ini Outdated
Comment thread avaframe/runCom4FlowPy.py Outdated
Comment thread avaframe/runCom4FlowPy.py
Comment thread avaframe/in3Utils/fileHandlerUtils.py Outdated
Comment thread avaframe/in3Utils/fileHandlerUtils.py Outdated

@ahuber-bfw ahuber-bfw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

some minor changes --> see comments

Comment thread avaframe/runCom4FlowPy.py Outdated
Comment thread avaframe/runCom4FlowPy.py Outdated
Comment thread avaframe/runCom4FlowPy.py Outdated
Comment thread avaframe/in3Utils/fileHandlerUtils.py Outdated
Comment thread avaframe/runCom4FlowPy.py Outdated
Comment thread avaframe/tests/test_com4FlowPy.py Outdated
Comment thread avaframe/tests/test_com4FlowPy.py
Comment thread avaframe/tests/test_com4FlowPy.py
Comment thread avaframe/tests/test_com4FlowPy.py Outdated
Comment thread avaframe/tests/test_com4FlowPy.py Outdated
@PaulaSp3
PaulaSp3 force-pushed the PS_FP_changeCfgRead branch 2 times, most recently from a968f92 to cacd41c Compare July 20, 2026 15:14

@ahuber-bfw ahuber-bfw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

schaut jetzt gut aus - 2-3 kleine Punkte noch:

  • ich hab noch ein paar kleine Änderungen gepusht (fe1faa3)
  • bitte für die neuen Funktionen im in3Utils/fileHandlerUtils noch jeweils einen Test ins entsprechende test_fileHandlerUtils file
  • evtl. die Doku noch anpassen für den neuen overwrite Parameter im .ini

dann passts von meiner Seite :)

Comment thread avaframe/in3Utils/fileHandlerUtils.py
Comment thread avaframe/in3Utils/fileHandlerUtils.py
@PaulaSp3
PaulaSp3 requested a review from ahuber-bfw July 22, 2026 07:14
@ahuber-bfw
ahuber-bfw force-pushed the PS_FP_changeCfgRead branch 2 times, most recently from 59be2ad to f0c2d55 Compare July 22, 2026 15:21

@ahuber-bfw ahuber-bfw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

pytests laufen alle durch
hab noch die Doku angepasst (vlt. kannst du da nochmal kurz drüber schauen @PaulaSp3)

commits sind gesquasht und rebased
von mir aus ready

Comment thread docs/moduleCom4FlowPy.rst Outdated
@ahuber-bfw ahuber-bfw assigned fso42 and awirb and unassigned PaulaSp3 Jul 22, 2026
main features/changes:

- runCom4FlowPy.main() now callable with cfg overwrite
    - function takes additional (optional) cfg parameter
    - function now returns a dictionary containing
    	- uid (simHash)
	- returnStatus on 'simulation performed' and 'resultOverwritten'
	- return message

- added additional config parameter to manage overwrite behavior (e.g.
  in case of already existing results with same simHash)
    - default (stock behavior, do not re-run simulation if valid model
      results for same config already exist)
    - reRunAndOverwrite (perform simulation, regardless of existing
      previous model results and delete existing)
    - reRunAndBackup (perform simulation, backup existing results)

updated com4FlowPy documentation for changes introduced by PR#1298

Co-authored-by: Paula Spannring <95042192+PaulaSp3@users.noreply.github.com>
@PaulaSp3
PaulaSp3 force-pushed the PS_FP_changeCfgRead branch from 0ce240d to b8981f1 Compare July 23, 2026 09:46
@PaulaSp3

PaulaSp3 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

standard tests ident (apart from snow glide test)

@PaulaSp3
PaulaSp3 merged commit c0458a3 into master Jul 23, 2026
5 checks passed
@PaulaSp3
PaulaSp3 deleted the PS_FP_changeCfgRead branch July 23, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flowPyDev Ideas for future development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[com4]: adapt skipping a simulation if already existing

4 participants