Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
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
RadioObservatory
LOFAR
Commits
1f8ded6b
Commit
1f8ded6b
authored
9 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
Task #8598: EoR job id is not per se an int, so treat id as string
parent
58b7df3d
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
LTA/LTAIngest/job_group.py.in
+9
-7
9 additions, 7 deletions
LTA/LTAIngest/job_group.py.in
with
9 additions
and
7 deletions
LTA/LTAIngest/job_group.py.in
+
9
−
7
View file @
1f8ded6b
...
@@ -37,13 +37,15 @@ class job_group():
...
@@ -37,13 +37,15 @@ class job_group():
self
.
parser
=
parser
.
parser
(
logger
)
self
.
parser
=
parser
.
parser
(
logger
)
self
.
mailCommand
=
mailCommand
self
.
mailCommand
=
mailCommand
self
.
get_db_info
()
self
.
get_db_info
()
self
.
logger
.
info
(
'
New job_group %
i
initialzed
'
%
self
.
Id
)
self
.
logger
.
info
(
'
New job_group %
s
initialzed
'
%
self
.
Id
)
def
read_old_jobs
(
self
,
faileddir
,
donedir
):
def
read_old_jobs
(
self
,
faileddir
,
donedir
):
done_files
=
[]
done_files
=
[]
failed_files
=
[]
failed_files
=
[]
if
self
.
Type
==
'
MoM
'
:
if
self
.
Type
==
'
MoM
'
:
Dir
=
'
/A_%s/
'
%
self
.
Id
Dir
=
'
/A_%s/
'
%
self
.
Id
elif
self
.
Type
.
lower
()
==
'
eor
'
:
Dir
=
'
EoR_%s/
'
%
self
.
Id
else
:
## tier0-ingest
else
:
## tier0-ingest
Dir
=
'
/B_%s/
'
%
self
.
Id
Dir
=
'
/B_%s/
'
%
self
.
Id
if
os
.
path
.
isdir
(
donedir
+
Dir
):
if
os
.
path
.
isdir
(
donedir
+
Dir
):
...
@@ -64,7 +66,7 @@ class job_group():
...
@@ -64,7 +66,7 @@ class job_group():
job
[
'
Status
'
]
=
JobError
job
[
'
Status
'
]
=
JobError
self
.
add_job
(
job
)
self
.
add_job
(
job
)
self
.
update_job
(
job
,
JobScheduled
,
JobError
,
None
)
self
.
update_job
(
job
,
JobScheduled
,
JobError
,
None
)
self
.
logger
.
info
(
'
New job_group %
i
has read %i old jobs
'
%
(
self
.
Id
,
len
(
done_files
)
+
len
(
failed_files
)))
self
.
logger
.
info
(
'
New job_group %
s
has read %i old jobs
'
%
(
self
.
Id
,
len
(
done_files
)
+
len
(
failed_files
)))
def
add_job
(
self
,
job
):
def
add_job
(
self
,
job
):
self
.
jobs
[
job
[
'
ExportID
'
]]
=
job
self
.
jobs
[
job
[
'
ExportID
'
]]
=
job
...
@@ -131,9 +133,9 @@ class job_group():
...
@@ -131,9 +133,9 @@ class job_group():
def
check_finished
(
self
):
def
check_finished
(
self
):
total
=
len
(
self
.
jobs
)
total
=
len
(
self
.
jobs
)
finished
=
(
self
.
scheduled
[
'
Total
'
]
==
0
)
and
(
self
.
active
[
'
Total
'
]
==
0
)
and
(
self
.
inactive
[
'
Total
'
]
==
0
)
and
(
self
.
retry
[
'
Total
'
]
==
0
)
finished
=
(
self
.
scheduled
[
'
Total
'
]
==
0
)
and
(
self
.
active
[
'
Total
'
]
==
0
)
and
(
self
.
inactive
[
'
Total
'
]
==
0
)
and
(
self
.
retry
[
'
Total
'
]
==
0
)
self
.
logger
.
debug
(
'
job_group %
i
progress: #done=%i #failed=%i #scheduled=%i #active=%i #inactive=%i #retry=%i
'
%
(
self
.
Id
,
self
.
done
[
'
Total
'
],
self
.
failed
[
'
Total
'
],
self
.
scheduled
[
'
Total
'
],
self
.
active
[
'
Total
'
],
self
.
inactive
[
'
Total
'
],
self
.
retry
[
'
Total
'
]))
self
.
logger
.
debug
(
'
job_group %
s
progress: #done=%i #failed=%i #scheduled=%i #active=%i #inactive=%i #retry=%i
'
%
(
self
.
Id
,
self
.
done
[
'
Total
'
],
self
.
failed
[
'
Total
'
],
self
.
scheduled
[
'
Total
'
],
self
.
active
[
'
Total
'
],
self
.
inactive
[
'
Total
'
],
self
.
retry
[
'
Total
'
]))
if
finished
and
(
total
==
self
.
failed
[
'
Total
'
]
+
self
.
done
[
'
Total
'
]):
## sanity check, somewhat redundant
if
finished
and
(
total
==
self
.
failed
[
'
Total
'
]
+
self
.
done
[
'
Total
'
]):
## sanity check, somewhat redundant
self
.
logger
.
info
(
'
job_group %
i
is finished, total of %i files
'
%
(
self
.
Id
,
total
))
self
.
logger
.
info
(
'
job_group %
s
is finished, total of %i files
'
%
(
self
.
Id
,
total
))
return
True
return
True
return
False
return
False
...
@@ -248,9 +250,9 @@ Total Failed: %(failed)i""" % {'done': self.done['Total'], 'corr': self.corr, 'b
...
@@ -248,9 +250,9 @@ Total Failed: %(failed)i""" % {'done': self.done['Total'], 'corr': self.corr, 'b
job_name
=
self
.
job_info
[
'
name
'
]
job_name
=
self
.
job_info
[
'
name
'
]
message
=
self
.
make_report
()
message
=
self
.
make_report
()
except
Exception
as
e
:
except
Exception
as
e
:
self
.
logger
.
error
(
'
Could not construct mail message for job_group %
i
'
%
(
self
.
Id
))
self
.
logger
.
error
(
'
Could not construct mail message for job_group %
s
'
%
(
self
.
Id
))
os
.
system
(
'
echo
"
%s
"
|mailx -s
"
Ingest job of %s, %s(%
i
) has ended
"
'
%
(
message
,
user
,
job_name
,
self
.
Id
)
+
self
.
mailCommand
)
os
.
system
(
'
echo
"
%s
"
|mailx -s
"
Ingest job of %s, %s(%
s
) has ended
"
'
%
(
message
,
user
,
job_name
,
self
.
Id
)
+
self
.
mailCommand
)
self
.
logger
.
info
(
'
job_group %
i
sent an email to %s
'
%
(
self
.
Id
,
self
.
mailCommand
))
self
.
logger
.
info
(
'
job_group %
s
sent an email to %s
'
%
(
self
.
Id
,
self
.
mailCommand
))
## Stand alone execution code ------------------------------------------
## Stand alone execution code ------------------------------------------
...
...
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