Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
AMBS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esde
machine-learning
AMBS
Commits
f6c518c5
Commit
f6c518c5
authored
4 years ago
by
Michael Langguth
Browse files
Options
Downloads
Patches
Plain Diff
Initial release of bash shell script to convert template workflow scripts to executable ones.
parent
f418c60b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
video_prediction_savp/env_setup/generate_workflow_scripts
+49
-0
49 additions, 0 deletions
video_prediction_savp/env_setup/generate_workflow_scripts
with
49 additions
and
0 deletions
video_prediction_savp/env_setup/generate_workflow_scripts
0 → 100644
+
49
−
0
View file @
f6c518c5
#!/usr/bin/env bash
# **************** Description ****************
# Converts given template workflow script (path has to be passed as first argument) to
# an executable workflow (Batch) script.
# Note, that this first argument has to be passed with "_template.sh" omitted!
# A second argument can be passed to set the e-mail address.
# On HDF-ML and Juwels, where jutil is available, this is done automatically,
# i.e. no second argument is required.
# Example:
# ./generate_workflow_scripts.sh ../HPC_scripts/generate m.mustermann@fz-juelich.de
# **************** Description ****************
#
#sanity checks
if
!
[
$#
-eq
1]
;
then
echo
"ERROR: Pass path to workflow script to be generated..."
else
curr_script
=
$1
fi
if
!
[[
-f
${
curr_script
}
_template.sh
]]
;
then
echo
"WARNING: Could not find expected Batch script '
${
curr_script
}
_template.sh'."
echo
"Thus, no corresponding executable script is created!"
exit
0
# still ok, i.e. only a WARNING is raised
fi
# create copy of template which is modified subsequenty
cp
${
curr_script
}
_template.sh
${
curr_script
}
_op.sh
# remove template identifiers
num_lines
=
`
awk
'/Template identifiers/{ print NR }'
line_s
=
`
echo
${
num_lines
}
|
cut
-d
' '
-f
1
`
line_e
=
`
echo
${
num_lines
}
|
cut
-d
' '
-f
2
`
if
[[
${
line_s
}
==
""
||
${
line_e
}
==
""
]]
;
then
echo
"ERROR:
${
curr_script
}
_template.sh exists, but does not seem to be a valid template script."
exit
1
else
sed
-e
'${line_s},${line_e}d'
${
curr_script
}
_op.sh
fi
# set correct e-mail address if possible, otherwise remove
if
!
[
-z
"
$2
"
]
;
then
USER_EMAIL
=
$2
else
if
[
command
-v
jutil
]
;
then
USER_EMAIL
=
$(
jutil user show
-o
json |
grep
email |
cut
-f2
-d
':'
|
cut
-f1
-d
','
|
cut
-f2
-d
'"'
)
else
USER_MAIL
=
""
fi
fi
sed
-i
"s/--mail-user=.*/--mail-user=
$USER_EMAIL
/g"
${
curr_script
}
_op.sh
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment