Skip to content

Commit 9c9a2c0

Browse files
committed
reformat
1 parent c69b098 commit 9c9a2c0

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

cmd/cloudexec/user_data.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type UserData struct {
1919
SetupCommands string
2020
RunCommand string
2121
Timeout string
22-
InputDirectory string
22+
InputDirectory string
2323
}
2424

2525
//go:embed user_data.sh.tmpl
@@ -47,7 +47,7 @@ func GenerateUserData(config config.Config, lc LaunchConfig) (string, error) {
4747
SetupCommands: strings.ReplaceAll(lc.Commands.Setup, `"`, `\"`),
4848
RunCommand: strings.ReplaceAll(lc.Commands.Run, `"`, `\"`),
4949
Timeout: timeoutStr,
50-
InputDirectory: lc.Input.Directory,
50+
InputDirectory: lc.Input.Directory,
5151
}
5252

5353
// Execute the template script with provided user data

cmd/cloudexec/user_data.sh.tmpl

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@ cleanup() {
128128
update_state "failed"
129129
fi
130130

131-
output_files="$(ls -A "$home/output/")"
131+
output_files="$(ls -A "${home}/output/")"
132132
if [[ -n ${output_files} ]]; then
133133
echo "Uploading results..."
134-
s3cmd put -r "$home/output/*" "s3://${BUCKET_NAME}/job-${JOB_ID}/output/"
134+
s3cmd put -r "${home}"/output/* "s3://${BUCKET_NAME}/job-${JOB_ID}/output/"
135135
else
136-
echo "Skipping results upload, no files found in $home/ouput"
136+
echo "Skipping results upload, no files found in ${home}/ouput"
137137
fi
138138

139139
if [[ -s ${stdout_log} ]]; then
@@ -201,20 +201,20 @@ trap cleanup EXIT SIGHUP SIGINT SIGTERM
201201
# Job-specific setup
202202

203203
echo "Running setup..."
204-
mkdir -p "$home/output"
204+
mkdir -p "${home}/output"
205205
eval "${SETUP_COMMANDS}"
206206

207207
echo "Downloading input archive..."
208-
s3cmd get -r "s3://${BUCKET_NAME}/job-${JOB_ID}/input.zip" "$home/"
209-
if [[ ! -s "$home/input.zip" ]]; then
208+
s3cmd get -r "s3://${BUCKET_NAME}/job-${JOB_ID}/input.zip" "${home}/"
209+
if [[ ! -s "${home}/input.zip" ]]; then
210210
echo "Error: Failed to download input archive"
211211
exit 1
212212
fi
213213

214214
echo "Unzipping input archive..."
215-
unzip "$home/input.zip" -d "$home/"
215+
unzip "${home}/input.zip" -d "${home}/"
216216

217-
source "$home/venv/bin/activate"
217+
source "${home}/venv/bin/activate"
218218

219219
# Update state to running
220220
update_state "running"
@@ -226,15 +226,16 @@ exit_code_flag="/tmp/cloudexec-exit-code"
226226
# Execute Job
227227

228228
# Use Ctrl-C to detach from the tmux session
229-
echo "bind-key -n C-c detach" > "$home/.tmux.conf"
229+
echo "bind-key -n C-c detach" >"${home}/.tmux.conf"
230230
# Run the tmux command in the background
231231
echo "Attach to the tmux session with 'cloudexec attach'"
232232
tmux_session="cloudexec"
233233
wrapped_run_command="$(
234234
cat <<-EOF
235235
set_exit_code() { echo \$? > ${exit_code_flag}; };
236236
trap set_exit_code EXIT;
237-
cd $home/${INPUT_DIRECTORY}
237+
cd ${home}/${INPUT_DIRECTORY}
238+
echo running workload from: ${home}/${INPUT_DIRECTORY}
238239
( ${RUN_COMMAND} ) > >(tee -a ${stdout_log}) 2> >(tee -a ${stderr_log} >&2);
239240
EOF
240241
)"

0 commit comments

Comments
 (0)