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
4dd10a34
There was a problem fetching the pipeline summary.
Commit
4dd10a34
authored
8 years ago
by
mads
Browse files
Options
Downloads
Patches
Plain Diff
hawc2_pbsjob included in cluster_simulation
parent
c14d1135
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!6
Clustertools
,
!5
Clustertools
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wetb/hawc2/hawc2_pbsjob.py
+0
-63
0 additions, 63 deletions
wetb/hawc2/hawc2_pbsjob.py
with
0 additions
and
63 deletions
wetb/hawc2/hawc2_pbsjob.py
deleted
100755 → 0
+
0
−
63
View file @
c14d1135
from
wetb.hawc2.htc_file
import
HTCFile
from
wetb.utils.cluster_tools.pbsjob
import
PBSJob
from
wetb.hawc2.log_file
import
LogInterpreter
import
os
import
time
from
wetb.utils.cluster_tools
import
pbsjob
class
HAWC2PBSJob
(
PBSJob
):
def
__init__
(
self
,
host
,
username
,
password
):
PBSJob
.
__init__
(
self
,
host
,
username
,
password
)
def
submit
(
self
,
job
,
cwd
,
pbs_out_file
):
with
open
(
cwd
+
job
)
as
fid
:
htcfilename
=
[
l
for
l
in
fid
if
l
.
startswith
(
'
wine
'
)][
0
].
rsplit
(
"
"
,
1
)[
1
].
strip
()
print
(
htcfilename
)
htcfile
=
HTCFile
(
cwd
+
htcfilename
)
self
.
log_filename
=
htcfile
.
simulation
.
logfile
[
0
]
self
.
loginterpreter
=
LogInterpreter
(
htcfile
.
simulation
.
time_stop
[
0
])
PBSJob
.
submit
(
self
,
job
,
cwd
,
pbs_out_file
)
def
status_monitor
(
self
,
update
=
5
):
i
=
0
self
.
loglinenumber
=
0
while
self
.
in_queue
():
i
+=
1
print
(
i
,
self
.
status
,
self
.
get_nodeid
())
if
self
.
status
is
pbsjob
.
RUNNING
:
#self.test()
scratch_log_filename
=
"
/scratch/%s/%s.g-000.risoe.dk/%s
"
%
(
self
.
client
.
username
,
self
.
jobid
,
self
.
log_filename
)
try
:
n
,
out
,
err
=
self
.
client
.
execute
(
'
tail --lines=+%d %s
'
%
(
self
.
loglinenumber
,
scratch_log_filename
))
self
.
loginterpreter
.
update_status
(
out
)
print
(
self
.
loginterpreter
.
status
,
self
.
loginterpreter
.
pct
,
self
.
loginterpreter
.
remaining_time
,
self
.
loginterpreter
.
lastline
)
with
open
(
"
status
"
+
self
.
jobid
,
'
w
'
)
as
fid
:
fid
.
write
(
"
;
"
.
join
([
self
.
loginterpreter
.
status
,
str
(
self
.
loginterpreter
.
pct
),
str
(
self
.
loginterpreter
.
remaining_time
),
self
.
loginterpreter
.
lastline
]))
#print (out)
self
.
loglinenumber
+=
out
.
count
(
"
\n
"
)
#print (err)
except
Warning
as
e
:
if
not
"
tail: cannot open
"
in
str
(
e
):
print
(
str
(
e
))
time
.
sleep
(
update
)
print
(
i
,
self
.
status
,
self
.
get_nodeid
())
def
test
(
self
):
self
.
log_filename
=
"
logfiles/short.log
"
scratch_log_filename
=
"
/scratch/%s/%s.g-000.risoe.dk/%s
"
%
(
self
.
client
.
username
,
self
.
jobid
,
self
.
log_filename
)
print
(
scratch_log_filename
)
try
:
n
,
out
,
err
=
self
.
client
.
execute
(
'
tail --lines=+%d %s
'
%
(
self
.
loglinenumber
,
scratch_log_filename
))
print
(
n
)
print
(
out
)
self
.
loglinenumber
+=
out
.
count
(
"
\n
"
)
print
(
err
)
except
Warning
as
e
:
print
(
str
(
e
))
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