Skip to content

Commit f75697b

Browse files
piotrklubaangranl-flexJunchengXuebenflexcomputemaciej-flexcompute
authored
Merge rc/25.6 to snappy main branch (#1347)
* Add Project Length To ValidationInfo (#1233) * Add project_length_unit to validation_info * Utilize validation_info when parsing multiconstructor model * Add unit test and fix format * Address comments * Address comment again * Address comments round 3 * feat(): add customize user agent for the request from python client (#1221) * feat(): add customize user agent for the request from python client * fix! * fix! * Fix formatting --------- Co-authored-by: BenYuan <ben@flexcompute.com> Co-authored-by: Ben <106089368+benflexcompute@users.noreply.github.com> * User expression support [POC] (#789) (#841) * User expression support [POC] (#789) * Added examples of a pydantic model using expressions * Example units support * Migrate to Pydantic V2 * Added variable support * Added units support in variable expressions * Added support for constrained types * Added tests, add support for unary operations * Make core blueprint package framework-agnostic, add support for partial evaluation of builtin solver variables (#858) * Move Flow360 and Tidy3D-specific logic outside of core blueprint module * Add support for partial evaluation of solver variables * Fix Python 3.9 compatibility * Added complete list of usable solver variables (#888) * Added complete list of usable solver variables * Add variable capture when creating simulation params * Serialization improvements * Fix serialization and deserialization issues --------- Co-authored-by: Andrzej Krupka <akrupka@Andrzejs-MacBook-Pro.local> * Ensure global scope variables are visible within validation service * Fix validation ordering bug * Allow extra fields in variable objects * Improved error messages (#945) * Nested expression support + expression validation endpoints (#946) * Nested variables are now available for use * Added expression validation endpoint support * Extend expressions endpoint to support multiple expressions * Add ability to use expressions in vector fields * Added numpy interop capabilities along with subscript operator support * Apply PR feedback --------- Co-authored-by: Andrzej Krupka <akrupka@Andrzejs-MacBook-Pro.local> * Reorganized solver variables into target namespaces (#986) * Reorganized solver variables into target namespaces * Apply PR feedback * Added ability to convert expressions to C++ syntax (#1009) Co-authored-by: Andrzej Krupka <akrupka@Andrzejs-MacBook-Pro.local> * Update CI yaml * Fix unit tests after alias changes * Removed unused __init__.py items --------- Co-authored-by: Andrzej Krupka <akrupka@Andrzejs-MacBook-Pro.local> Co-authored-by: benflexcompute <ben@flexcompute.com> * Add dependency cycle checking and add non-dimensioned array handling to expression validation service (#1013) Co-authored-by: Andrzej Krupka <akrupka@Andrzejs-MacBook-Pro.local> * Validation service fixes, better error messages (#1030) * Validation service fixes * Fix aliasing issues, fix numpy interop with dimensioned variables * Apply PR feedback * Ready to merge --------- Co-authored-by: Andrzej Krupka <akrupka@Andrzejs-MacBook-Pro.local> Co-authored-by: benflexcompute <ben@flexcompute.com> * Added unit handling to solver code converter (#1049) * Validation service fixes * Fix aliasing issues, fix numpy interop with dimensioned variables * Apply PR feedback * Added unit stripping when converting to solver code * Add a general name preprocessing function instead of unit stripping * Finalize unit -> solver conversion function * Add user variable inlining for solver code generation --------- Co-authored-by: Andrzej Krupka <akrupka@Andrzejs-MacBook-Pro.local> Co-authored-by: benflexcompute <ben@flexcompute.com> * Expressions fixes, demonstrating E2E capability for user-variable expressions (#1082) * Validation service fixes * Fix aliasing issues, fix numpy interop with dimensioned variables * Apply PR feedback * Added unit stripping when converting to solver code * Add a general name preprocessing function instead of unit stripping * Finalize unit -> solver conversion function * Add user variable inlining for solver code generation * Demonstrating E2E case with expressions * Fix variable initialization when loading from file * Removed non-release code * Fixed unit test --------- Co-authored-by: Andrzej Krupka <akrupka@Andrzejs-MacBook-Pro.local> Co-authored-by: benflexcompute <ben@flexcompute.com> * Pylint Fix for `expression` branch (#1083) * wip * More fixes * Another batch of linter fixes * Another round of linter fixes * Fixed most unit test, now fixing extra error * Fixing all the unit tests, pylint etc * Fix unit test * Fix unit test --------- Co-authored-by: Andrzej Krupka <akrupka@Andrzejs-MacBook-Pro.local> * Rolled back to python list types, no numpy interop as of now because it is not compatible with solver translation (#1108) * Rolled back to python list types, no numpy interop as of now because it is not compatible with solver translation * Format --------- Co-authored-by: Andrzej Krupka <akrupka@Andrzejs-MacBook-Pro.local> Co-authored-by: benflexcompute <ben@flexcompute.com> * Partial expression evaluation, example of a builtin function (#1115) * Cross in Pyhton mode works * WIP now needing for refactor to enable function on-demand import since current structure causes circular import * Some comments * Got symbolic evaluation to work but very HACKY * Refactored expressions module structure to be self-contained (still contains cyclic imports but only runtime, never at init...) * Partial evaluation before solver code translation * More fixes, simplify deserializer logic * Format * Fixed unit test as many as possible, only 1 left * Fixing most of the pylint issues * Fixed allow_inf_nan when evaluating expressions with solver variables * eagerly evaluation and also taking advantage of unyt pacakge * Small fixes * Fix invalid list initialization syntax in the C++ code generator * Added back the as_vector() implementation * Renamed raise_error * Remove extra evaluation call in cross, reduce unnecessary parentheses * some more small changes --------- Co-authored-by: benflexcompute <ben@flexcompute.com> Co-authored-by: Andrzej Krupka <akrupka@Andrzejs-MacBook-Pro.local> * Fixed merging * Fixed V1 tests * [FL-729] [FLPY-7] Dimensioned Volume Output (#1012) * Added unit test, now pending fixing lint and todos * Ready for review * Fix for windows-1 * Format * Another attempt * Thank you Windows * should work now * Enabled all output types to use UserVariable (#1148) * Added unit test for project_variables and also simplified the translation unit test (#1151) * Added unit test for project_variables and also simplified the translation unit test * Removed print * Fix windows test * Added util function to get the unit from expression (#1157) * Added util function to get the unit from expression * removed print * Added catch for input_params is None * fix lint * Disables vector arithmetics for variables (#1158) * List all solver variables (#1150) * Initial implementation * More variable finished * Fix unit test * Fix pylint * Fix the issue that solver name is not used * Move prepending code to translator * Fix prepending code * Fix deserialize issue that output units is not loaded * self review of prepending code * typo fix * Address comments * fix grad pressure's prepending code * Added support for solver variable in output_fields and also fixed a bug when translating Mach (#1160) --------- Co-authored-by: Ben <106089368+benflexcompute@users.noreply.github.com> * Separate prepending code to declaration and computation parts (#1165) * Initial implementation * More variable finished * Fix unit test * Fix pylint * Fix the issue that solver name is not used * Move prepending code to translator * Fix prepending code * Fix deserialize issue that output units is not loaded * self review of prepending code * typo fix * Address comments * fix grad pressure's prepending code * Added support for solver variable in output_fields and also fixed a bug when translating Mach (#1160) * Replace wall shear stress with its magnitude, add unit test to whitelisted_callables * Fix coordinate, remove mu * Fix the scaling of turbulence solution * Fix the unit conversion for a list of float * Add missing vorticty magnitude * remove declaration when user-specified name is the same as the solver_name * Add velocity magnitude * Address comments * formatting --------- Co-authored-by: Ben <106089368+benflexcompute@users.noreply.github.com> * UserVariable as Token and value from context (#1161) * Implementation done, now checking pylint * Now writing the overwrite checker * Ready for self review * Enabled timestepping->step size to be expression too (#1166) * Enabled timestepping->step size to be expression too * Bumped version * Handles NaN desearilization (#1168) * Added proper base for surface probe output * Ben y/expression front end feedback (#1169) * Updated the project variables schema * rename gradient * Added translator for ValurOrExpression object (#1175) * Added postProcessing flag setter (#1176) * Added postProcessing flag setter * Fixed unit test * Fixed v1 unit test * Decouple solver variable's solver name with user variable name (#1170) * Initial implementation * Fix unit test * Expression validation bundle (#1181) * 1. Single UDF has single dimensionality * Change in_unit to in_units * Change in_unit to in_units Signed-off-by: BenYuan <ben@flexcompute.com> * Fixed unit test * Fixed all unit tests * Trying to fix windows * Removed unnecessary prints * Added legacy checker * added more test * Disabled degF and degC for the Expression --------- Signed-off-by: BenYuan <ben@flexcompute.com> * Fix heatflux related solver variables (#1186) * Fix heat flux related solverVariables * Remove unnecessary debug script * [Registry Rescale] Use solutionRescale in the prepending code (#1184) * Fixed unary op not allowed by expression (#1187) * Fix temperature output with user variable (#1194) * Fix the prepending code for temperature * Add unit test * Remove debug script * [TODOs pending] More Math Functions for `Expression` (#1185) * Added math function cross for 2 component * Added dot function * Added sqrt * removed unnecessary callable assingment * added translator unit test * [Angran] More operation added, needs double check * Added some unit tests, removed pow() since it is duplicate --------- Co-authored-by: Angran Li <angran@flexcompute.com> * Enable more fields to use value or expression (#1199) * Added all unit tests for ValueOrExpression fields * Added configure API to limit acceptance of the runtime expressions * Removed print * removed print, added extra=allow * Add more unit tests and validations for math operations (#1196) * Add validation and unit tests for multiple math operation * Handle mixture of unyt_quantity and expression/variable when using min/max function, add unit test for edge cases * Add more edge cases test * Add more edge cases and replace all dimensionality to dimensions * Add the remaining unit test and clean up todo list * Removed print * Address comments --------- Co-authored-by: BenYuan <ben@flexcompute.com> Co-authored-by: Ben <106089368+benflexcompute@users.noreply.github.com> * Added dependency graph and variable pre-sorting (#1202) * added dependency graph, now need to add the topo_sort * added dependency graph, now need to add the topo_sort * Fix lint and format * Added unit test and added the sort to init variable space. What about the validate expresion though???... * Fixed a bug in deserializer where syntax errors are not exposed (#1200) * Fixed a bug in deserializer where syntax errors are not exposed * Fix unit test * Fix lint * Fix unit test * Fixed validaiton service for not cleanning the cache and also that no dependency graph built for sorign (#1204) * Deploy again (#1208) * Add expression support for Isosurface (#1201) * Add validation and unit tests for multiple math operation * Handle mixture of unyt_quantity and expression/variable when using min/max function, add unit test for edge cases * Add more edge cases test * Add more edge cases and replace all dimensionality to dimensions * Add the remaining unit test and clean up todo list * Initial implementation * Validation fix * Add validation for using empty list in UserVariable * Add unit for for isosurface validation * Add validation for iso_value length * Fix translator for IsosurfaceOutput * Fix unit test * Fix unit test * Use new unit system for non-dimensionalization of random units in iso_value * Fix incorrect isovalue for dimensioned output * Update unit test to use a irregular units as iso value * Changed isoValue schema (#1207) * Exclude project_variables from nondimensionalization * Specify exclude in the individual class * some minor patching * Add unit to validate iso value's translation --------- Co-authored-by: BenYuan <ben@flexcompute.com> Co-authored-by: Ben <106089368+benflexcompute@users.noreply.github.com> * Removed validate_expression() (#1212) * Using discriminator to differencetiatye Value VS Expresison (#1215) * Added function to print all the output units for all post processing variables (#1213) * Added funciton to print all the output units for all post processing variables * some comments * Add validation to check the usage of surface specific solution variable in non-surface output fields (#1216) * Add validation to check the usage of surface specific solution variable in non-surface output fields * Address comments * Fix unit test * Added check for dependent features (#1218) * Now hand over to helper * Added check for dependent features * Removed print * Added missing check * Update SurfaceIntegralOutput for UserVariable (#1214) * rename node_normals to node_area_vector and add node_unit_normal * Update surfaceIntegral and UDF validation * Automatically multiply area to the surfaceIntegralOutput * Update tests/simulation/params/test_validators_params.py Co-authored-by: Ben <106089368+benflexcompute@users.noreply.github.com> * Create a new user variable for surface integral * Address comments * Address comments --------- Co-authored-by: Ben <106089368+benflexcompute@users.noreply.github.com> * More IsosurfaceOutput changes for Expression (#1220) * Initial implementation * fix get_output_units and corresponding unit test * Add unit test * Improve unit test * address comments * Enable usage of constant value as output variables. (#1219) * Enable usage of constant value as output variables. * Remove print * Added pi (#1222) * Added pi * Removed print * Renamed project_variables to variable_context (#1224) * Temporary disable unit system when validating ValueOrExpression (#1225) * Fixed the iso_value field validator dependency resulting in wrong error (#1230) * Fixed the iso_value field validator dependency resulting in wrong error * Revert accidental comment * formatter * [Expression] Add functions to get/remove/show user variables (#1226) * Reraise a different redeclaration error when loading simulation json * Fix error during translating isosurface * Add functions to get/remove/show user variables * Address comments * Changed texting * Fix lint --------- Co-authored-by: Ben <106089368+benflexcompute@users.noreply.github.com> Co-authored-by: BenYuan <ben@flexcompute.com> * Skip feature-dependent validation for expressions that are not used (#1223) * Skip feature-dependent validaiton for expressions that are not used * Added recursive finding of dependendt variables * lint * [SCFD-5773] Fix issue where semicolumn breaks AST (#1231) * replace validated_by with boolean option for clear context (#1232) * Reviewed, improved error message and loc * Some polishing * [SCFD-5806] Add solver side internal variables to the block lsit * Convert number user variables to expression * Fix lint * Removed evaluated value/units * Fix lint and unit test --------- Signed-off-by: BenYuan <ben@flexcompute.com> Co-authored-by: Andrzej Krupka <156919532+andrzej-krupka@users.noreply.github.com> Co-authored-by: Andrzej Krupka <akrupka@Andrzejs-MacBook-Pro.local> Co-authored-by: benflexcompute <ben@flexcompute.com> Co-authored-by: Ben <106089368+benflexcompute@users.noreply.github.com> Co-authored-by: Angran <angran@flexcompute.com> * Add 'main' branch references * Update auto hotfix workflow (#1241) * Add updater for from_mach_reynolds (#1252) * [25.5] Add prefix option to read_all_v1_BETDisks function (#1253) (#1255) * initial implementation * Add index offset option * Address comment Co-authored-by: Angran <angran@flexcompute.com> * Enabled power operation on vector variables (#1257) * Enabled power operation on variables * Fix CI --------- Co-authored-by: Angran <angran@flexcompute.com> * Remove ceil and floor functions (#1259) * Added bounding box info in support of inhouse symmetric (#1258) * Added bounding box info * Ready for testing, proper validaiton pending * deploy now, test pending * Fixed unit tests * Ready for testing * fixed unit test * Ready * Bump version due to addition of the global_bounding_box * Misc expression fixes (#1264) * Added support for front end JSON support when expression is empty/None * Regulated the unit symbols that can be used in the expression * Fixed unit test * Resource reuse logic increase robustness (#1267) * WIP * Now fixing UDD * Fixed udd ordering * Need to know how the density works * Ready * READY * Remove logging to file by default (#1269) * Remove file logger * Try again * try again --------- Co-authored-by: BenYuan <ben@flexcompute.com> * [FXC-1886] Fix incorrect dimensional output when liquid op is used (#1265) * Fix unit conversion bug for liquid * 1. Use liquid flow360 unit system for UDF conversion when liquid op is used 2. Fix unit test * Fix compare_values and replace all incorrect checks * Address comments * Also fix other conversion factor --------- Co-authored-by: BenYuan <ben@flexcompute.com> * Move get_flow360_unit_system_liquid out for manifest usage (#1273) * [SCFD-5640] Disable the same surface being used in more than one Surface/TimeaverageSurfaceOutput (#1270) * [SCFD-5825] Remove 'p' and 'rho' from iso field (#1275) * Fix updater of from_mach_reynolds (#1276) * Fix updater of from_mach_reynolds * revert minor change * removed dev from example (#1272) Co-authored-by: Ben <106089368+benflexcompute@users.noreply.github.com> * Added legacy tagging for previous UDFs (#1281) Co-authored-by: Angran Li <angran@flexcompute.com> * fix(): misuse of .sort() which return None (#1282) * fix(): misuse of .sort() which return None * address comments * [Expression] Removed postProcessing key in the context and also added support for description (#1280) * [Expression] Removed postProcessing key in the context and also added support for description * isort --------- Co-authored-by: Angran <angran@flexcompute.com> * [SCFD-5945] Fix location of the expression validation error and also fix issues caused by converting the value variable to expression. (#1283) * [SCFD-5945] Corrected the location for expression error * proposed fix * Rebase anyway --------- Co-authored-by: Angran Li <angran@flexcompute.com> * [SCFD-5015] Projected frontal area support (#1262) * [SCFD-5015] Projected frontal area support * [SCFD-5943] Added translator support for the auto area * fix linter * Fix Deserialize function when handling None description (#1286) * Update to_file implementatino to exclude None when dumpping json * Make sure deserialize can handle None description situation * Add fixed to_yaml * adopted the proposed flex credit example (#1284) * adoptes the proposed flex credit example * black * removed leading spaces * separate get_project_records out (#1287) * Remedy on the GhostCircularPlane existence check (#1288) * Removed the fall back of using Flow360Params (#1289) * Removed the fall back of using Flow360Params * Fix lint * Revert "Removed the fall back of using Flow360Params (#1289)" (#1290) This reverts commit 211ef14. * Remove get expanded entity list during preprocessing params for translator (#1292) * Remove expanded enttiy list * fix pylint * Added v1 fallback original error * Bump version * [Hotfix Main]: Added version command and better project loading error (#1296) * Added version command and better project loading error (#1295) * Added version command and better project loading error * fixed unit tests * resolved conflict --------- Co-authored-by: Ben <106089368+benflexcompute@users.noreply.github.com> Co-authored-by: BenYuan <ben@flexcompute.com> * Load the storage region from the backend response (#1299) * load the storage region from the backend response * Bump version * Added updater for entities being in multiple outputs (#1293) * WIP * Added updater for entities being in multiple outputs * Deduplicate first before removing surfaces --------- Co-authored-by: Angran <angran@flexcompute.com> * bump to 25.5.2b4 (#1300) * Removed aws_region in the model (#1302) * Example python file for post-processing time-averaged isosurfaces (#1291) * example file for time-averaged isosurfaces * added post-processing * added post-processing * added some text * changed temp folder to local folder * black validation * removed paths for download * removed lines * removed lines * removed lines * Some improvement on the `flow360 version` command (#1305) * Some improvement * formatting * Bump version for 25.6 official release (#1306) * [FXC-2051] Removed unsteady initial_blade_direction check and also removed comments in v1 json (#1310) * Bump to 25.6.3 (#1313) * Fix the hotfix yaml not being able to handle the anti column (#1311) * [FXC-2051] Removed unsteady initial_blade_direction check and also removed comments in v1 json * Fix the hotfix yaml not being able to handle the * Fix auto hotfix * Speed up the loading of the entities by using set and also reduce complexity with supplied known hash set (#1316) (#1320) * Speed up the loading of the entities by using set and also reduce complecity with supplied known hash set * Remove description * Ready * Fix lint * Added a redunet test.. (#1318) (#1323) * [FXC-1974] Dry run for run_case() (#1334) * [FXC-1974] Dry run for run_case() Fix linting [FXC-2051] Removed unsteady initial_blade_direction check and also removed comments in v1 json (#1310) (#1312) * Added for sm and vm generations too * revert change on examples * [FXC-2006] Disable boundary completeness and deletion validation (#1330) * [FSC-2006] Disable boundary completness and deletion validation * Fix unit test * [FXC-2059] Added planar_face_tolerance translator for legacy mesher and also unified the validation (#1329) * [FSC-2006] Disable boundary completness and deletion validation * Fix unit test * [FXC-2059] Added planar_face_tolerance translator for legacy mesher and also unified the validaiton * Bumped to 25.6.4 (#1338) * Updated the description of the planar_face_tolerance (#1342) * fix(): `planar_face_tolerance` might be missing and causing validation to fail (#1344) * fix(): planar_face_tolerance might be missing and causing validaiton to fail * ensure valid param * Fixed test * feat: add rename method to v2 assets (#1333) + feat: add tags filtering to Project.get_case_ids, Project.get_project_ids, and metadata (#1346) * feat: Migrate Folder class to v2 API (#1317) * [FXC-2051] Removed unsteady initial_blade_direction check and also removed comments in v1 json (#1310) (#1312) * bug(): Removed duplicate pressure output when pressure is specified (#1309) * feat: migrate Folder class to v2 API endpoints * remove unused v1 import, run styling + lint checks * rerun isort + lint * disable pylint duplicate code * fix example files * delete test_folder_tree.py * delete examples, remove comments, update pydantic * fix: run linting + formatting --------- Co-authored-by: Ben <106089368+benflexcompute@users.noreply.github.com> * feat: Add folder parameter to project creation (#1325) * feat: add rename method to v2 assets (#1333) * feat: add rename method to v2 assets (Folder, Project, SurfaceMesh, VolumeMesh, Case, etc) * fix: raise rename method to AssetBase class * fix: remove self return after renaming asset * fix: remove return docstring + missed self returns * feat: add tags filtering to Project.get_case_ids, Project.get_project_ids, and metadata (#1341) * feat: add tag filtering support to Project class + metadata and class property, get_case_ids/get_project_ids methods 499f63b * fix: remove unused imports + dangerous default value * feat: add property tags to AssetBase --------- Co-authored-by: dawood <mrblackcto@outlook.com> * formatting changes * formatting * Bump to 25.6.5 and also add default value application to planar tolerance (#1348) * fixed plannar tolerance import issue * volume_meshing_translator_fix --------- Signed-off-by: BenYuan <ben@flexcompute.com> Co-authored-by: Angran <angran@flexcompute.com> Co-authored-by: JunchengXue <97111055+JunchengXue@users.noreply.github.com> Co-authored-by: BenYuan <ben@flexcompute.com> Co-authored-by: Ben <106089368+benflexcompute@users.noreply.github.com> Co-authored-by: Maciej Skarysz <83596707+maciej-flexcompute@users.noreply.github.com> Co-authored-by: Andrzej Krupka <156919532+andrzej-krupka@users.noreply.github.com> Co-authored-by: Andrzej Krupka <akrupka@Andrzejs-MacBook-Pro.local> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Wiktor <wiktor.krzew@flexcompute.com> Co-authored-by: marcvivesmassana <marc.vives@flexcompute.com> Co-authored-by: dawood <mrblackcto@outlook.com> Co-authored-by: Maciej Skarysz <maciej@flexcompute.com>
1 parent 89673f2 commit f75697b

File tree

139 files changed

+23499
-1637
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+23499
-1637
lines changed

.github/workflows/codestyle.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
# This workflow will upload a Python Package using Twine when a release is created
2-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3-
4-
# This workflow uses actions that are not certified by GitHub.
5-
# They are provided by a third-party and are governed by
6-
# separate terms of service, privacy policy, and support
7-
# documentation.
8-
91
name: Codestyle checking
102

113
on:

.github/workflows/create-hotfix-pr.yml

Lines changed: 75 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@ on:
55
types:
66
- closed # Trigger when a PR is closed
77
branches:
8-
- develop # Only when the PR targets the 'develop' branch
8+
- 'release-candidate/*' # Trigger for any branch starting with 'release-candidate/'
99

1010
jobs:
1111
create_hotfix_pr:
1212
# Only run this job if the PR was actually merged
1313
if: github.event.pull_request.merged == true
1414
runs-on: ubuntu-latest
1515
permissions:
16-
contents: write # To push branches and commit changes
16+
contents: write # To push branches and commit changes
1717
pull-requests: write # To create the pull request
1818

1919
env:
20-
HOTFIX_BRANCHES: '["release-candidate/25.5", "release-candidate/25.2"]' # Your target branch for the hotfix PR
2120
BOT_NAME: "flow360-auto-hotfix-bot" # Name for the git committer
2221
BOT_EMAIL: "flow360-auto-hotfix-bot@users.noreply.github.com" # Email for the git committer
2322

@@ -42,42 +41,94 @@ jobs:
4241
run: |
4342
echo "sha=${{ github.event.pull_request.merge_commit_sha }}" >> $GITHUB_OUTPUT
4443
echo "branch_name=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT
44+
echo "base_branch=${{ github.event.pull_request.base.ref }}" >> $GITHUB_OUTPUT
45+
46+
- name: Get Hotfix Target Branches
47+
id: get_target_branches
48+
run: |
49+
PR_BASE_BRANCH="${{ steps.get_commit.outputs.base_branch }}"
50+
echo "PR was merged into: $PR_BASE_BRANCH"
51+
52+
TARGET_BRANCHES=("main") # Always target main for hotfix
53+
54+
# Get all remote 'release-candidate' branches with version pattern as YY.I or YY.II
55+
ALL_RELEASE_CANDIDATE_BRANCHES=$(git branch -r | grep 'origin/release-candidate/' | sed 's/.*origin\///' | grep -E '^release-candidate/[0-9]{2}\.[0-9]{1,2}$' | sort -V)
56+
echo "Found release-candidate branches: $ALL_RELEASE_CANDIDATE_BRANCHES"
57+
58+
# Determine the version of the current PR's base branch
59+
# Example: release-candidate/25.5 -> 25.05 (for proper numerical comparison)
60+
PR_BASE_VERSION=$(echo "$PR_BASE_BRANCH" | sed -n 's/release-candidate\/\([0-9]\{2\}\)\.\([0-9]\{1,2\}\)/\1.\2/p')
61+
62+
# Handle cases like 25.5 vs 25.05 for comparison
63+
if [[ "$PR_BASE_VERSION" =~ ^[0-9]{2}\.[0-9]$ ]]; then
64+
PR_BASE_VERSION=$(echo "$PR_BASE_VERSION" | awk '{printf "%s%02d", substr($1,1,3), substr($1,4)}')
65+
fi
66+
67+
if [[ -n "$PR_BASE_VERSION" ]]; then
68+
echo "Base branch version: $PR_BASE_VERSION"
69+
for branch in $ALL_RELEASE_CANDIDATE_BRANCHES; do
70+
# Extract version for comparison
71+
BRANCH_VERSION=$(echo "$branch" | sed -n 's/release-candidate\/\([0-9]\{2\}\)\.\([0-9]\{1,2\}\)/\1.\2/p')
72+
73+
if [[ -n "$BRANCH_VERSION" ]]; then
74+
if [[ "$BRANCH_VERSION" =~ ^[0-9]{2}\.[0-9]$ ]]; then
75+
BRANCH_VERSION=$(echo "$BRANCH_VERSION" | awk '{printf "%s%02d", substr($1,1,3), substr($1,4)}')
76+
fi
77+
78+
# Compare versions
79+
if (( $(echo "$BRANCH_VERSION > $PR_BASE_VERSION" | bc -l) )); then
80+
TARGET_BRANCHES+=("$branch")
81+
echo "Adding $branch (version $BRANCH_VERSION) as it's higher than $PR_BASE_BRANCH (version $PR_BASE_VERSION)"
82+
fi
83+
fi
84+
done
85+
fi
86+
87+
# Prepare output for next step
88+
HOTFIX_BRANCHES_JSON=$(printf '%s\n' "${TARGET_BRANCHES[@]}" | jq -R . | jq -s .)
89+
DELIMITER=$(uuidgen) # Generate a unique delimiter
90+
echo "HOTFIX_BRANCHES<<$DELIMITER" >> $GITHUB_OUTPUT
91+
echo "$HOTFIX_BRANCHES_JSON" >> $GITHUB_OUTPUT
92+
echo "$DELIMITER" >> $GITHUB_OUTPUT
93+
echo "Calculated hotfix target branches: ${TARGET_BRANCHES[@]}"
94+
4595
4696
- name: Define Branch Names
4797
id: define_branches
4898
run: |
4999
ORIGINAL_PR_NUMBER=${{ github.event.pull_request.number }}
50100
# Convert JSON array to space-separated list
51-
BRANCHES=$(echo '${{ env.HOTFIX_BRANCHES }}' | jq -r '.[]')
101+
BRANCHES=$(echo '${{ steps.get_target_branches.outputs.HOTFIX_BRANCHES }}' | jq -r '.[]')
52102
53103
# Create outputs for all branches
54104
branch_list=""
55105
for branch in $BRANCHES; do
56-
new_branch="hotfix-${branch}-pr${ORIGINAL_PR_NUMBER}"
106+
new_branch="hotfix-${branch//\//-}-pr${ORIGINAL_PR_NUMBER}" # Replace '/' with '-' for new branch name
57107
branch_list+="${branch}:${new_branch} "
58108
done
59109
60110
# Remove trailing space and store the list
61111
branch_list="${branch_list% }"
62112
echo "branch_pairs=${branch_list}" >> $GITHUB_OUTPUT
63-
113+
64114
- name: Create and Process Hotfix Branches
65115
env:
66116
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
117+
PR_TITLE: ${{ github.event.pull_request.title }}
67118
run: |
68119
# Read branch pairs and process each one
69120
IFS=' ' read -r -a PAIRS <<< "${{ steps.define_branches.outputs.branch_pairs }}"
70-
121+
71122
for pair in "${PAIRS[@]}"; do
72123
IFS=':' read -r base_branch new_branch <<< "$pair"
73-
124+
74125
echo "Processing hotfix for branch: $base_branch"
75-
126+
76127
# Create and switch to new branch
77128
git checkout "$base_branch"
78129
git pull origin "$base_branch"
79130
git checkout -b "$new_branch"
80-
131+
81132
# Attempt cherry-pick
82133
if ! git cherry-pick ${{ steps.get_commit.outputs.sha }} --empty=keep; then
83134
echo "Cherry-pick encountered conflicts for $base_branch, attempting to resolve..."
@@ -89,7 +140,7 @@ jobs:
89140
continue # Skip PR creation if no changes after resolution
90141
fi
91142
git cherry-pick --continue
92-
143+
93144
if [ $? -eq 0 ]; then
94145
echo "Successfully resolved conflicts for $base_branch"
95146
had_conflicts="true"
@@ -116,15 +167,21 @@ jobs:
116167
# Push branch
117168
if git push origin "$new_branch"; then
118169
echo "Successfully pushed branch $new_branch"
119-
170+
120171
# Create PR
121172
PR_NUMBER="${{ github.event.pull_request.number }}"
122173
PR_URL="${{ github.event.pull_request.html_url }}"
123174
PR_AUTHOR="${{ github.event.pull_request.user.login }}"
124175
125-
base_branch_name=${base_branch#"release-candidate/"}
126-
PR_TITLE="[Hotfix $base_branch_name]: ${{ github.event.pull_request.title }}"
127-
PR_BODY="Hotfix of PR #${PR_NUMBER} (${PR_URL}) to the \`${base_branch}\` branch.
176+
# Adjust PR title based on the target branch
177+
if [[ "$base_branch" == "main" ]]; then
178+
HOTFIX_PR_TITLE="[Hotfix Main]: $PR_TITLE"
179+
else
180+
base_branch_name=${base_branch#"release-candidate/"}
181+
HOTFIX_PR_TITLE="[Hotfix $base_branch_name]: $PR_TITLE"
182+
fi
183+
184+
PR_BODY="Hotfix of PR #${PR_NUMBER} (${PR_URL}) to the \`${base_branch}\` branch.
128185
Hey @${PR_AUTHOR}, please review this hotfix PR created from your original PR."
129186
130187
# Add conflict warning if needed
@@ -133,9 +190,10 @@ jobs:
133190
134191
### ⚠️ **Note:** This PR had conflicts with the base branch and was resolved automatically. Please review the changes carefully."
135192
fi
136-
193+
194+
# Create PR using gh cli
137195
gh pr create \
138-
--title "$PR_TITLE" \
196+
--title "$HOTFIX_PR_TITLE" \
139197
--body "$PR_BODY" \
140198
--head "$new_branch" \
141199
--base "$base_branch" \

.github/workflows/test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ name: unit testing
33
on:
44
workflow_dispatch:
55
push:
6-
branches: [ develop, release-candidate/* ]
6+
branches: [ main, develop, release-candidate/* ]
77
pull_request:
88
types: [ opened, synchronize, reopened, ready_for_review ]
9-
branches: [ develop, release-candidate/* ]
109
workflow_call:
1110

1211
jobs:
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
import tarfile
2+
3+
import flow360 as fl
4+
from flow360.examples import IsolatedPropeller
5+
6+
IsolatedPropeller.get_files()
7+
8+
project = fl.Project.from_geometry(IsolatedPropeller.geometry, name="Time-averaged isosurfaces")
9+
10+
geometry = project.geometry
11+
geometry.group_edges_by_tag("edgeId")
12+
geometry.group_faces_by_tag("faceName")
13+
14+
with fl.SI_unit_system:
15+
rotating_cylinder = fl.Cylinder(
16+
name="Rotating zone", center=[0, 0, 0], axis=[1, 0, 0], outer_radius=2, height=0.8
17+
)
18+
refinement_cylinder = fl.Cylinder(
19+
name="Refinement zone", center=[1.9, 0, 0], axis=[1, 0, 0], outer_radius=2, height=4
20+
)
21+
slice = fl.Slice(name="Slice", normal=[1, 0, 0], origin=[0.6, 0, 0])
22+
volume_zone_rotating_cylinder = fl.RotationCylinder(
23+
name="Rotation cylinder",
24+
spacing_axial=0.05,
25+
spacing_radial=0.05,
26+
spacing_circumferential=0.05,
27+
entities=[rotating_cylinder],
28+
enclosed_entities=[geometry["*"]],
29+
)
30+
farfield = fl.AutomatedFarfield(name="Farfield")
31+
params = fl.SimulationParams(
32+
meshing=fl.MeshingParams(
33+
defaults=fl.MeshingDefaults(
34+
surface_max_edge_length=1, boundary_layer_first_layer_thickness=0.1 * fl.u.mm
35+
),
36+
refinements=[
37+
fl.UniformRefinement(
38+
name="Uniform refinement", spacing=0.025, entities=[refinement_cylinder]
39+
)
40+
],
41+
volume_zones=[farfield, volume_zone_rotating_cylinder],
42+
),
43+
reference_geometry=fl.ReferenceGeometry(
44+
area=1, moment_center=[0, 0, 0], moment_length=[1, 1, 1]
45+
),
46+
operating_condition=fl.AerospaceCondition(velocity_magnitude=20),
47+
models=[
48+
fl.Wall(name="Wall", surfaces=[geometry["*"]]),
49+
fl.Freestream(name="Freestream", surfaces=[farfield.farfield]),
50+
fl.Fluid(
51+
navier_stokes_solver=fl.NavierStokesSolver(relative_tolerance=0.01),
52+
turbulence_model_solver=fl.SpalartAllmaras(
53+
relative_tolerance=0.01, hybrid_model=fl.DetachedEddySimulation()
54+
),
55+
),
56+
fl.Rotation(
57+
name="Rotation",
58+
volumes=[rotating_cylinder],
59+
spec=fl.AngularVelocity(value=200 * fl.u.rpm),
60+
),
61+
],
62+
time_stepping=fl.Unsteady(
63+
steps=600,
64+
step_size=0.0025,
65+
max_pseudo_steps=35,
66+
CFL=fl.AdaptiveCFL(
67+
min=0.1, max=10000, max_relative_change=1, convergence_limiting_factor=0.5
68+
),
69+
),
70+
outputs=[
71+
fl.SurfaceOutput(
72+
name="Surface output",
73+
output_fields=["Cp", "yPlus", "Cf", "CfVec"],
74+
surfaces=[geometry["*"]],
75+
),
76+
fl.SliceOutput(
77+
name="Slice output",
78+
output_fields=["qcriterion", "vorticity", "Mach"],
79+
slices=[slice],
80+
),
81+
fl.TimeAverageIsosurfaceOutput(
82+
isosurfaces=[
83+
fl.Isosurface(name="q_criterion_avg", field="qcriterion", iso_value=0.0004128)
84+
],
85+
start_step=420,
86+
output_fields=["velocity_magnitude"],
87+
output_format="both",
88+
),
89+
],
90+
)
91+
92+
case = project.run_case(params, name="Time-averaged isosurfaces")
93+
case.wait()
94+
results = case.results
95+
96+
# download slice and isosurfaces output files as tar.gz archives
97+
results.slices.download("slices.tar.gz", overwrite=True)
98+
results.isosurfaces.download("isosurfaces.tar.gz", overwrite=True)
99+
100+
# extract slices file
101+
file = tarfile.open("slices.tar.gz")
102+
file.extractall("slices")
103+
file.close()
104+
105+
# extract isosurfaces file
106+
file = tarfile.open("isosurfaces.tar.gz")
107+
file.extractall("isosurfaces")
108+
file.close()

examples/workflow_management/data_management/cloud_organization/change_account_and_submit.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import flow360 as fl
22
from flow360.examples import OM6wing
33

4-
fl.Env.dev.active()
5-
64
# choose shared account interactively
75
fl.Accounts.choose_shared_account()
86

0 commit comments

Comments
 (0)