Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DCT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
graintracking
DCT
Commits
42d824f7
Commit
42d824f7
authored
10 years ago
by
Nicola Vigano
Browse files
Options
Downloads
Patches
Plain Diff
OAR/GUI: fixed ordering and naming of arrays
Signed-off-by:
Nicola Vigano
<
nicola.vigano@esrf.fr
>
parent
3fefb965
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
zUtil_Python/dct_batch_gui.py
+19
-7
19 additions, 7 deletions
zUtil_Python/dct_batch_gui.py
zUtil_Python/dct_batch_oar_parameters.py
+29
-20
29 additions, 20 deletions
zUtil_Python/dct_batch_oar_parameters.py
with
48 additions
and
27 deletions
zUtil_Python/dct_batch_gui.py
+
19
−
7
View file @
42d824f7
...
...
@@ -42,13 +42,20 @@ class DCTBatchGui(QtGui.QWidget):
self
.
_pbutt_load_params
()
def
_init_gui
(
self
):
self
.
resize
(
1
024
,
768
)
self
.
resize
(
1
280
,
768
)
self
.
_center_gui
()
self
.
setWindowTitle
(
"
DCT Batch GUI
"
)
self
.
array_list
=
QtGui
.
QTreeWidget
()
self
.
array_list
.
setColumnCount
(
7
)
self
.
array_list
.
setHeaderLabels
([
"
ID
"
,
"
Name
"
,
"
Status
"
,
"
Exit code
"
,
"
Submitted
"
,
"
Launched
"
,
"
Finished
"
])
self
.
array_list
.
setColumnCount
(
8
)
self
.
array_list
.
setHeaderLabels
([
"
ID
"
,
"
Name
"
,
"
Status
"
,
"
Exit code
"
,
"
Submitted
"
,
"
Launched
"
,
"
Finished
"
,
"
Resubmitted ID
"
])
self
.
array_list
.
header
().
resizeSection
(
0
,
140
)
self
.
array_list
.
header
().
resizeSection
(
1
,
140
)
self
.
array_list
.
header
().
resizeSection
(
2
,
80
)
self
.
array_list
.
header
().
resizeSection
(
3
,
80
)
self
.
array_list
.
header
().
resizeSection
(
4
,
140
)
self
.
array_list
.
header
().
resizeSection
(
5
,
140
)
self
.
array_list
.
header
().
resizeSection
(
6
,
140
)
hbox_array_control
=
QtGui
.
QHBoxLayout
()
hbox_array_control
.
addWidget
(
self
.
array_list
)
...
...
@@ -257,6 +264,7 @@ class DCTBatchGui(QtGui.QWidget):
"
Job %d, resubmitted with id: %d
"
%
(
orig_job_id
,
new_job_id
))
dial
.
exec_
()
self
.
records
.
update_content_arrays
()
self
.
update_display_arrays
()
def
_pbutt_delete_job
(
self
):
...
...
@@ -305,9 +313,9 @@ class DCTBatchGui(QtGui.QWidget):
def
update_display_arrays
(
self
):
self
.
array_list
.
clear
()
for
(
array
_key
,
array_content
)
in
self
.
records
.
arrays
.
iteritems
()
:
array_item
=
QtGui
.
QTreeWidgetItem
([
"
Array: %d
"
%
array
_key
,
])
for
job
in
array
_content
:
for
array
in
self
.
records
.
arrays
:
array_item
=
QtGui
.
QTreeWidgetItem
([
"
Array: %d
"
%
array
[
'
array_id
'
],
array
[
'
function
'
]
])
for
job
in
array
[
'
jobs
'
]
:
if
job
[
'
exit_code
'
]
is
None
:
exit_code
=
""
else
:
...
...
@@ -325,9 +333,13 @@ class DCTBatchGui(QtGui.QWidget):
stop_time
=
""
else
:
stop_time
=
datetime
.
datetime
.
fromtimestamp
(
job
[
'
stopTime
'
]).
strftime
(
'
%Y-%m-%d %H:%M:%S
'
)
if
job
[
'
resubmit_job_id
'
]
==
0
:
resub_id
=
""
else
:
resub_id
=
"
%d
"
%
job
[
'
resubmit_job_id
'
]
job_info
=
[
"
Job: %d
"
%
job
[
'
Job_Id
'
],
name
,
\
job
[
'
state
'
],
exit_code
,
sub_time
,
start_time
,
\
stop_time
]
stop_time
,
resub_id
]
job_item
=
QtGui
.
QTreeWidgetItem
(
QtCore
.
QStringList
(
job_info
))
array_item
.
addChild
(
job_item
)
array_item
.
setExpanded
(
True
)
...
...
This diff is collapsed.
Click to expand it.
zUtil_Python/dct_batch_oar_parameters.py
+
29
−
20
View file @
42d824f7
...
...
@@ -16,15 +16,12 @@ class DCTBatchOarParameters(object):
Constructor
'''
self
.
parent
=
parent
self
.
arrays
=
{}
self
.
arrays
=
[]
self
.
array_ids
=
{}
if
stream
is
not
None
:
self
.
load_content_from_oarparameters
(
stream
)
def
_sort_jobs
(
self
,
field
=
'
submissionTime
'
):
for
aid
in
self
.
arrays
.
keys
():
self
.
arrays
[
aid
]
=
self
.
_sort_by_field
(
self
.
arrays
[
aid
],
field
)
def
_sort_by_field
(
self
,
in_list
,
field
):
contents
=
[
x
[
field
]
for
x
in
in_list
]
indices
=
sorted
(
range
(
len
(
contents
)),
key
=
contents
.
__getitem__
)
...
...
@@ -55,12 +52,8 @@ class DCTBatchOarParameters(object):
print
(
"
Not doing anything
"
)
return
arrays
=
{}
arrays_content
=
{}
for
aid
in
array_ids
:
arrays
[
aid
]
=
[]
print
(
"
Query Array ID: %d
"
%
aid
)
content
=
self
.
parent
.
qapi
.
query
(
array
=
aid
)
...
...
@@ -73,8 +66,6 @@ class DCTBatchOarParameters(object):
print
(
"
Not doing anything
"
)
return
self
.
arrays
=
{}
print
(
"
Query Job IDs: %s
"
%
"
,
"
.
join
((
"
%d
"
%
x
for
x
in
jobs
)))
content
=
self
.
parent
.
qapi
.
query
(
jobs
=
jobs
)
...
...
@@ -88,16 +79,31 @@ class DCTBatchOarParameters(object):
# Content is supposed to be in structures, where the Job ID is the main
# thing
jobs
=
[
job
for
job
in
content
.
itervalues
()]
self
.
_sort_by_field
(
jobs
,
'
submissionTime
'
)
jobs
=
self
.
_sort_by_field
(
jobs
,
'
Job_Id
'
)
map_arrays
=
{}
array_ids
=
(
x
for
x
in
set
((
job
[
'
array_id
'
]
for
job
in
jobs
)))
self
.
arrays
=
{};
for
aid
in
array_ids
:
self
.
arrays
[
aid
]
=
[]
map_arrays
[
aid
]
=
{
'
array_id
'
:
aid
,
'
function
'
:
''
,
'
jobs
'
:
[]}
for
job
in
jobs
:
type
(
job
[
'
array_id
'
])
self
.
arrays
[
job
[
'
array_id
'
]].
append
(
job
)
array_id
=
job
[
'
array_id
'
]
if
len
(
map_arrays
[
array_id
][
'
jobs
'
])
==
0
:
map_arrays
[
array_id
][
'
function
'
]
=
job
[
'
name
'
]
map_arrays
[
array_id
][
'
jobs
'
].
append
(
job
)
for
aid
in
array_ids
:
map_arrays
[
aid
][
'
jobs
'
]
=
self
.
_sort_by_field
(
map_arrays
[
aid
][
'
jobs
'
],
'
Job_Id
'
)
self
.
arrays
=
[
array
for
array
in
map_arrays
.
itervalues
()]
self
.
arrays
=
self
.
_sort_by_field
(
self
.
arrays
,
'
array_id
'
)
self
.
_sort_jobs
()
self
.
array_ids
=
{}
for
ia
in
range
(
len
(
self
.
arrays
)):
aid
=
self
.
arrays
[
ia
][
'
array_id
'
]
self
.
array_ids
[
aid
]
=
ia
def
get_current_array_and_job
(
self
,
selected
):
if
selected
.
row
()
==
-
1
:
...
...
@@ -105,16 +111,17 @@ class DCTBatchOarParameters(object):
parent
=
selected
.
parent
()
array_ids
=
[
x
for
x
in
self
.
arrays
.
iterkey
s
()
]
array_ids
=
self
.
_get_array_id
s
()
if
parent
.
row
()
==
-
1
:
array_id
=
array_ids
[
selected
.
row
()]
return
(
array_id
,
None
)
else
:
array_id
=
array_ids
[
parent
.
row
()]
return
(
array_id
,
self
.
arrays
[
ar
ray_id
][
selected
.
row
()])
return
(
array_id
,
self
.
arrays
[
p
ar
ent
.
row
()][
'
jobs
'
][
selected
.
row
()])
def
update_content_arrays
(
self
):
self
.
load_content_from_arrayids_query_oar
(
self
.
arrays
.
iterkeys
())
array_ids
=
self
.
_get_array_ids
()
self
.
load_content_from_arrayids_query_oar
(
array_ids
)
def
update_content_jobs
(
self
):
jobs
=
[]
...
...
@@ -124,4 +131,6 @@ class DCTBatchOarParameters(object):
self
.
load_content_from_jobids_query_oar
(
jobs
)
def
_get_array_ids
(
self
):
return
[
x
[
'
array_id
'
]
for
x
in
self
.
arrays
]
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