Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
job-pattern-rule-evaluation-wip
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
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PathoJobs
job-pattern-rule-evaluation-wip
Commits
980aa037
Commit
980aa037
authored
4 months ago
by
Alex Wiens
Browse files
Options
Downloads
Patches
Plain Diff
Prule.db: Fix bugs
parent
942a2909
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
prule/db/__init__.py
+17
-8
17 additions, 8 deletions
prule/db/__init__.py
with
17 additions
and
8 deletions
prule/db/__init__.py
+
17
−
8
View file @
980aa037
...
...
@@ -7,6 +7,7 @@ import sqlite3
class
ResultsDB
:
def
__init__
(
self
,
path
):
self
.
path
=
path
self
.
con
=
sqlite3
.
connect
(
path
)
self
.
rule_dict
=
None
def
close
(
self
):
...
...
@@ -121,6 +122,7 @@ rulename TEXT
res
=
cur
.
execute
(
'
SELECT DISTINCT cluster from jobs;
'
)
clusters
=
[]
for
c
in
res
.
fetchall
():
if
c
[
0
]
!=
None
:
clusters
.
append
(
c
[
0
])
return
clusters
...
...
@@ -132,6 +134,7 @@ rulename TEXT
res
=
cur
.
execute
(
'
SELECT DISTINCT user FROM jobs WHERE cluster = ?;
'
,
[
cluster
])
users
=
[]
for
u
in
res
.
fetchall
():
if
u
[
0
]
!=
None
:
users
.
append
(
u
[
0
])
return
users
...
...
@@ -143,6 +146,7 @@ rulename TEXT
res
=
cur
.
execute
(
'
SELECT DISTINCT project FROM jobs WHERE cluster = ?;
'
,
[
cluster
])
projects
=
[]
for
p
in
res
.
fetchall
():
if
p
[
0
]
!=
None
:
projects
.
append
(
p
[
0
])
return
projects
...
...
@@ -150,19 +154,19 @@ rulename TEXT
cur
=
self
.
con
.
cursor
()
cur
.
execute
(
"
SELECT * FROM jobs WHERE ccid = ?
"
,
[
ccid
])
res
=
cur
.
fetchall
()
return
res
return
self
.
db_rows_to_dicts
(
res
,
'
jobs
'
)
def
db_get_result_slurm
(
self
,
slurmid
,
cluster
):
cur
=
self
.
con
.
cursor
()
cur
.
execute
(
"
SELECT * FROM jobs WHERE jobid = ? AND cluster = ?
"
,
[
slurmid
,
cluster
])
res
=
cur
.
fetchall
()
return
res
return
self
.
db_rows_to_dicts
(
res
,
'
jobs
'
)
def
db_get_all_results
(
self
):
cur
=
self
.
con
.
cursor
()
cur
.
execute
(
"
SELECT * FROM jobs
"
)
res
=
cur
.
fetchall
()
return
res
return
self
.
db_rows_to_dicts
(
res
,
'
jobs
'
)
def
db_insert_failure
(
self
,
ccjobid
):
res
=
self
.
db_get_result
(
ccjobid
)
...
...
@@ -288,12 +292,17 @@ rulename TEXT
res
=
cur
.
fetchall
()
return
self
.
db_rows_to_dicts
(
res
,
'
jobs
'
)
def
__
db_last_result
(
self
):
def
db_last_result
(
self
):
cur
=
self
.
con
.
cursor
()
cur
.
execute
(
"
SELECT * FROM jobs ORDER BY rowid DESC LIMIT 1;
"
)
res
=
cur
.
fetchall
()
return
self
.
db_rows_to_dicts
(
res
,
'
jobs
'
)
def
db_first_result
(
self
):
cur
=
self
.
con
.
cursor
()
cur
.
execute
(
"
SELECT * FROM jobs ORDER BY rowid ASC LIMIT 1;
"
)
res
=
cur
.
fetchall
()
return
self
.
db_rows_to_dicts
(
res
,
'
jobs
'
)
def
db_rule_stats
(
self
,
cluster
):
...
...
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