Skip to content

Commit 6449256

Browse files
bclyons12claude
andauthored
Fix D3D data fetching: unify localhost and remote parameter handling (#1024)
* Fix D3D data fetching: unify localhost and remote parameter handling This commit fixes inconsistencies between localhost and remote execution paths for D3D experimental data fetching that caused remote users to lose access to configuration options available to localhost users. Issues fixed: 1. Remote path hardcoded EFIT02/ZIPFIT01, ignoring user parameters - Now respects EFIT_tree, PROFILES_tree parameters - Now respects CER_analysis_type parameter - Now respects EFIT_run_id and PROFILES_run_id parameters 2. Dead code reference to omas_data_fetch.py - File was removed in commit 2351652 but still referenced in upsync - Removed from upsync command to prevent rsync failures 3. Undocumented module version difference - Added comment explaining omfit vs omfit/unstable usage Implementation: - Created unified omas_command template with OUTPUT_FILE placeholder - Both localhost and remote paths now use identical OMAS command construction - Ensures DRY principle and prevents future divergence Related PRs: #929 (localhost enhancements that weren't propagated to remote) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Unify omfit module --------- Co-authored-by: Claude <[email protected]>
1 parent 208e5fa commit 6449256

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

src/cases/D3D.jl

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ function case_parameters(::Val{:D3D}, shot::Int;
7878
efit_shot = shot
7979
end
8080

81+
# Build OMAS command string (same for both localhost and remote execution)
82+
# Note: OUTPUT_FILE is a placeholder that gets replaced with actual path (local or remote)
83+
omas_command = "python -u $(omas_root)/omas/examples/fuse_data_export.py OUTPUT_FILE d3d $shot $EFIT_tree $PROFILES_tree --CER_ANALYSIS_TYPE=$CER_analysis_type"
84+
if length(EFIT_run_id) > 0
85+
omas_command *= " --EFIT_RUN_ID $EFIT_run_id"
86+
end
87+
if length(PROFILES_run_id) > 0
88+
omas_command *= " --PROFILES_RUN_ID $PROFILES_run_id"
89+
end
90+
8191
if omfit_host == "localhost"
8292
setup_block = """#!/bin/bash -l
8393
module purge
@@ -88,14 +98,8 @@ function case_parameters(::Val{:D3D}, shot::Int;
8898
omfit_block = """
8999
python -u $(omfit_root)/omfit/omfit.py $(omfit_root)/modules/RABBIT/SCRIPTS/rabbit_input_no_gui.py "shot=$shot" "output_path='$local_path'" > /dev/null 2> /dev/null
90100
"""
91-
omas_block = """
92-
python -u $(omas_root)/omas/examples/fuse_data_export.py $local_path/$filename d3d $shot $EFIT_tree $PROFILES_tree --CER_ANALYSIS_TYPE=$CER_analysis_type"""
93-
if length(EFIT_run_id) >0
94-
omas_block *= " --EFIT_RUN_ID $EFIT_run_id"
95-
end
96-
if length(PROFILES_run_id) >0
97-
omas_block *= " --PROFILES_RUN_ID $PROFILES_run_id"
98-
end
101+
# Substitute OUTPUT_FILE placeholder with actual path for localhost
102+
omas_block = replace(omas_command, "OUTPUT_FILE" => "$local_path/$filename")
99103
omfit_sh = joinpath(local_path, "omfit.sh")
100104
open(omfit_sh, "w") do io
101105
return write(io, setup_block*omfit_block)
@@ -122,7 +126,7 @@ function case_parameters(::Val{:D3D}, shot::Int;
122126
123127
# Load any required modules
124128
module purge
125-
module load omfit/unstable
129+
module load omfit
126130
127131
echo "Starting parallel tasks..." >&2
128132
@@ -134,7 +138,7 @@ function case_parameters(::Val{:D3D}, shot::Int;
134138
135139
python -u $(omfit_root)/omfit/omfit.py $(omfit_root)/modules/RABBIT/SCRIPTS/rabbit_input_no_gui.py "shot=$shot" "output_path='$remote_path'" > /dev/null 2> /dev/null &
136140
137-
python -u $(omas_root)/omas/examples/fuse_data_export.py $remote_path/$(filename) d3d $shot EFIT02 ZIPFIT01
141+
$(replace(omas_command, "OUTPUT_FILE" => "$remote_path/$(filename)"))
138142
139143
echo "Waiting for OMFIT D3D BEAMS data fetching to complete..." >&2
140144
wait
@@ -149,15 +153,15 @@ function case_parameters(::Val{:D3D}, shot::Int;
149153
150154
# Use rsync to create directory if it doesn't exist and copy the script
151155
$(ssh_command(omfit_host, "\"mkdir -p $remote_path\""))
152-
$(upsync_command(omfit_host, ["$(local_path)/remote_slurm.sh", "$(local_path)/omas_data_fetch.py"], remote_path))
156+
$(upsync_command(omfit_host, ["$(local_path)/remote_slurm.sh"], remote_path))
153157
154158
# Execute script remotely
155159
$(ssh_command(omfit_host, "\"module load omfit; cd $remote_path && bash remote_slurm.sh\""))
156160
157161
# Retrieve results using rsync
158162
$(downsync_command(omfit_host, ["$remote_path/$(filename)", "$remote_path/nbi_ods_$shot.h5", "$remote_path/beams_$shot.dat"], local_path))
159163
"""
160-
164+
161165
open(joinpath(local_path, "local_driver.sh"), "w") do io
162166
return write(io, local_driver)
163167
end

0 commit comments

Comments
 (0)