Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
StorageLeaf
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
ProjectLeaf
StorageLeaf
Commits
c8ce45e3
Commit
c8ce45e3
authored
3 years ago
by
Robert Goldmann
Browse files
Options
Downloads
Patches
Plain Diff
list manual job in job list until it's done
parent
fc64d68c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/logic/JobScheduler.py
+13
-3
13 additions, 3 deletions
src/logic/JobScheduler.py
with
13 additions
and
3 deletions
src/logic/JobScheduler.py
+
13
−
3
View file @
c8ce45e3
...
@@ -27,6 +27,8 @@ class JobScheduler:
...
@@ -27,6 +27,8 @@ class JobScheduler:
self
.
_jobAutomatic
=
self
.
_scheduler
.
add_job
(
func
=
dummyFunc
,
args
=
[],
trigger
=
'
interval
'
,
self
.
_jobAutomatic
=
self
.
_scheduler
.
add_job
(
func
=
dummyFunc
,
args
=
[],
trigger
=
'
interval
'
,
minutes
=
60
,
id
=
self
.
ID_AUTO
,
timezone
=
TIMEZONE
)
minutes
=
60
,
id
=
self
.
ID_AUTO
,
timezone
=
TIMEZONE
)
self
.
_jobManual
=
None
self
.
_jobStatus
=
{
self
.
_jobStatus
=
{
self
.
ID_AUTO
:
self
.
STATE_IDLE
,
self
.
ID_AUTO
:
self
.
STATE_IDLE
,
self
.
ID_MANUAL
:
self
.
STATE_IDLE
self
.
ID_MANUAL
:
self
.
STATE_IDLE
...
@@ -61,7 +63,7 @@ class JobScheduler:
...
@@ -61,7 +63,7 @@ class JobScheduler:
if
self
.
_jobStatus
[
self
.
ID_MANUAL
]
==
self
.
STATE_RUNNING
:
if
self
.
_jobStatus
[
self
.
ID_MANUAL
]
==
self
.
STATE_RUNNING
:
raise
JobAlreadyRunningError
(
f
'
Job
"
{
self
.
ID_MANUAL
}
"
is already running!
'
)
raise
JobAlreadyRunningError
(
f
'
Job
"
{
self
.
ID_MANUAL
}
"
is already running!
'
)
self
.
_scheduler
.
add_job
(
func
=
func
,
args
=
args
,
trigger
=
'
date
'
,
self
.
_jobManual
=
self
.
_scheduler
.
add_job
(
func
=
func
,
args
=
args
,
trigger
=
'
date
'
,
run_date
=
datetime
.
now
()
+
timedelta
(
seconds
=
5
),
run_date
=
datetime
.
now
()
+
timedelta
(
seconds
=
5
),
id
=
self
.
ID_MANUAL
,
timezone
=
TIMEZONE
)
id
=
self
.
ID_MANUAL
,
timezone
=
TIMEZONE
)
self
.
_jobStatus
[
self
.
ID_MANUAL
]
=
self
.
STATE_RUNNING
self
.
_jobStatus
[
self
.
ID_MANUAL
]
=
self
.
STATE_RUNNING
...
@@ -74,6 +76,14 @@ class JobScheduler:
...
@@ -74,6 +76,14 @@ class JobScheduler:
next_run
=
str
(
job
.
next_run_time
))
next_run
=
str
(
job
.
next_run_time
))
jobs
.
append
(
scheduledJob
)
jobs
.
append
(
scheduledJob
)
isManualJobInList
=
any
(
job
for
job
in
jobs
if
job
.
job_id
==
self
.
ID_MANUAL
)
isManualJobRunning
=
self
.
_jobStatus
[
self
.
ID_MANUAL
]
==
self
.
STATE_RUNNING
if
isManualJobRunning
and
not
isManualJobInList
:
jobs
.
append
(
Schemas
.
ScheduledJob
(
job_id
=
self
.
ID_MANUAL
,
run_frequency
=
str
(
self
.
_jobManual
.
trigger
),
next_run
=
str
(
self
.
_jobManual
.
next_run_time
)))
return
Schemas
.
ScheduledJobStatus
(
jobs
=
jobs
,
job_results
=
self
.
_jobResults
)
return
Schemas
.
ScheduledJobStatus
(
jobs
=
jobs
,
job_results
=
self
.
_jobResults
)
...
...
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