Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
west
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WindEnergyAtOST
west
Commits
2eafd116
Commit
2eafd116
authored
3 years ago
by
Alain Schubiger
Browse files
Options
Downloads
Patches
Plain Diff
module to submit jobs to hpc
parent
cc925232
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
submit_to_hpc.py
+39
-0
39 additions, 0 deletions
submit_to_hpc.py
with
39 additions
and
0 deletions
submit_to_hpc.py
0 → 100644
+
39
−
0
View file @
2eafd116
import
os
import
sys
from
pathlib
import
Path
from
subprocess
import
Popen
,
PIPE
import
yaml
def
subprocess_cmd
(
cmd
):
global
output
global
error
proc
=
Popen
(
cmd
,
stdout
=
PIPE
,
stderr
=
PIPE
,
shell
=
True
)
stdout
,
stderr
=
proc
.
communicate
()
output
=
stdout
.
decode
(
sys
.
getdefaultencoding
())
error
=
stderr
.
decode
(
sys
.
getdefaultencoding
())
num_nodes
=
1
jobcomment
=
'
test
'
wds
=
[
90
,
150
,
240
]
# sectors to run, leave empty if sectors in yaml config should be used
fluent_version
=
20.2
# read input config
with
open
(
'
config.yaml
'
)
as
f
:
config
=
yaml
.
load
(
f
,
Loader
=
yaml
.
FullLoader
)
site_name
=
config
[
'
site
'
][
'
name
'
]
sub_script
=
'
python /home/pool/poweruserhpc/scripts/submitScripts/subfluent.py
'
if
not
wds
:
wds
=
[
x
for
x
in
config
[
'
setup
'
][
'
wind_directions
'
]]
parent
=
Path
.
cwd
()
for
wd
in
wds
:
os
.
chdir
(
parent
/
'
simulation/rans
'
/
f
'
winddir-
{
wd
:
03.0
f
}
'
)
print
(
Path
.
cwd
())
sub_cmd
=
f
'
{
sub_script
}
-s 3ddp -f RANS.jou -n
{
num_nodes
}
-j
{
site_name
}
_
{
wd
:
03.0
f
}
_
{
jobcomment
}
-v
{
fluent_version
}
'
print
(
sub_cmd
)
subprocess_cmd
(
sub_cmd
)
# os.chdir(parent)
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