Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WindEnergyToolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
toolbox
WindEnergyToolbox
Commits
10a97b3a
Commit
10a97b3a
authored
8 years ago
by
Mads M. Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
avoided shell=true in hawc2.simulation
parent
1dd24a80
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wetb/hawc2/simulation.py
+21
-4
21 additions, 4 deletions
wetb/hawc2/simulation.py
with
21 additions
and
4 deletions
wetb/hawc2/simulation.py
+
21
−
4
View file @
10a97b3a
...
...
@@ -27,6 +27,7 @@ from wetb.utils.cluster_tools.pbsjob import SSHPBSJob, DONE, NOT_SUBMITTED
from
wetb.utils.cluster_tools.ssh_client
import
SSHClient
from
wetb.utils.timing
import
print_time
from
_datetime
import
datetime
from
subprocess
import
STDOUT
standard_library
.
install_aliases
()
from
threading
import
Thread
...
...
@@ -463,11 +464,27 @@ class SimulationThread(Thread):
#else:
# self.process = subprocess.Popen('wine "%s" %s 1> %s 2>&1' % (hawc2exe, htcfile, stdout), stdout=None, stderr=None, shell=True, cwd=modelpath)
if
isinstance
(
hawc2exe
,
tuple
):
self
.
process
=
subprocess
.
Popen
(
'
%s
"
%s
"
%s 1> %s 2>&1
'
%
(
hawc2exe
+
(
htcfile
,
stdout
)),
stdout
=
None
,
stderr
=
None
,
shell
=
True
,
cwd
=
modelpath
)
else
:
self
.
process
=
subprocess
.
Popen
(
'"
%s
"
%s 1> %s 2>&1
'
%
(
hawc2exe
,
htcfile
,
stdout
),
stdout
=
None
,
stderr
=
None
,
shell
=
True
,
cwd
=
modelpath
)
#, creationflags=CREATE_NO_WINDOW)
with
open
(
os
.
path
.
join
(
self
.
modelpath
,
stdout
),
'
wb
'
)
as
stdout
:
if
isinstance
(
hawc2exe
,
tuple
):
self
.
process
=
subprocess
.
Popen
(
list
(
hawc2exe
+
(
htcfile
,
stdout
)),
stdout
=
stdout
,
stderr
=
STDOUT
,
shell
=
False
,
cwd
=
modelpath
)
else
:
self
.
process
=
subprocess
.
Popen
([
hawc2exe
,
htcfile
],
stdout
=
stdout
,
stderr
=
STDOUT
,
shell
=
False
,
cwd
=
modelpath
)
#, creationflags=CREATE_NO_WINDOW)
self
.
process
.
communicate
()
# if isinstance(hawc2exe, tuple):
# self.process = subprocess.Popen('%s "%s" %s 1> %s 2>&1' % (hawc2exe + (htcfile, stdout)), stdout=None, stderr=None, shell=False, cwd=modelpath)
# else:
# self.process = subprocess.Popen('"%s" %s 1> %s 2>&1' % (hawc2exe, htcfile, stdout), stdout=None, stderr=None, shell=False, cwd=modelpath) #, creationflags=CREATE_NO_WINDOW)
# with open("cmd.txt", 'w') as fid:
# fid.write("cd %s\n" % modelpath)
# fid.write('"%s" %s 1> %s 2>&1' % (hawc2exe, htcfile, stdout))
import
psutil
try
:
self
.
sim
.
host
.
resource
.
process_name
=
psutil
.
Process
(
self
.
process
.
pid
).
name
()
except
:
pass
Thread
.
start
(
self
)
...
...
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