Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
beat
beat.web
Commits
27344682
Commit
27344682
authored
8 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
[backend] Add job state (kill)
parent
78c1e61c
No related branches found
No related tags found
1 merge request
!194
Scheduler
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
beat/web/backend/migrations/0002_scheduler_addons.py
+2
-2
2 additions, 2 deletions
beat/web/backend/migrations/0002_scheduler_addons.py
beat/web/backend/models.py
+5
-3
5 additions, 3 deletions
beat/web/backend/models.py
with
7 additions
and
5 deletions
beat/web/backend/migrations/0002_scheduler_addons.py
+
2
−
2
View file @
27344682
...
@@ -146,7 +146,7 @@ class Migration(migrations.Migration):
...
@@ -146,7 +146,7 @@ class Migration(migrations.Migration):
name
=
'
Job
'
,
name
=
'
Job
'
,
fields
=
[
fields
=
[
(
'
id
'
,
models
.
AutoField
(
verbose_name
=
'
ID
'
,
serialize
=
False
,
auto_created
=
True
,
primary_key
=
True
)),
(
'
id
'
,
models
.
AutoField
(
verbose_name
=
'
ID
'
,
serialize
=
False
,
auto_created
=
True
,
primary_key
=
True
)),
(
'
status
'
,
models
.
CharField
(
default
=
b
'
N
'
,
max_length
=
1
,
choices
=
[(
b
'
N
'
,
b
'
Queued
'
),
(
b
'
P
'
,
b
'
Processing
'
),
(
b
'
C
'
,
b
'
Completed
'
),
(
b
'
F
'
,
b
'
Failed
'
),
(
b
'
S
'
,
b
'
Skipped
'
),
(
b
'
L
'
,
b
'
Cancelled
'
)])),
(
'
status
'
,
models
.
CharField
(
default
=
b
'
N
'
,
max_length
=
1
,
choices
=
[(
b
'
N
'
,
b
'
Queued
'
),
(
b
'
P
'
,
b
'
Processing
'
),
(
b
'
C
'
,
b
'
Completed
'
),
(
b
'
F
'
,
b
'
Failed
'
),
(
b
'
S
'
,
b
'
Skipped
'
),
(
b
'
L
'
,
b
'
Cancelled
'
)
,
(
b
'
K
'
,
b
'
Kill
'
)
])),
(
'
runnable_date
'
,
models
.
DateTimeField
(
null
=
True
,
blank
=
True
)),
(
'
runnable_date
'
,
models
.
DateTimeField
(
null
=
True
,
blank
=
True
)),
(
'
start_date
'
,
models
.
DateTimeField
(
null
=
True
,
blank
=
True
)),
(
'
start_date
'
,
models
.
DateTimeField
(
null
=
True
,
blank
=
True
)),
(
'
end_date
'
,
models
.
DateTimeField
(
null
=
True
,
blank
=
True
)),
(
'
end_date
'
,
models
.
DateTimeField
(
null
=
True
,
blank
=
True
)),
...
@@ -163,7 +163,7 @@ class Migration(migrations.Migration):
...
@@ -163,7 +163,7 @@ class Migration(migrations.Migration):
(
'
split_index
'
,
models
.
PositiveIntegerField
()),
(
'
split_index
'
,
models
.
PositiveIntegerField
()),
(
'
start_index
'
,
models
.
PositiveIntegerField
(
null
=
True
)),
(
'
start_index
'
,
models
.
PositiveIntegerField
(
null
=
True
)),
(
'
end_index
'
,
models
.
PositiveIntegerField
(
null
=
True
)),
(
'
end_index
'
,
models
.
PositiveIntegerField
(
null
=
True
)),
(
'
status
'
,
models
.
CharField
(
default
=
b
'
N
'
,
max_length
=
1
,
choices
=
[(
b
'
N
'
,
b
'
Queued
'
),
(
b
'
P
'
,
b
'
Processing
'
),
(
b
'
C
'
,
b
'
Completed
'
),
(
b
'
F
'
,
b
'
Failed
'
),
(
b
'
S
'
,
b
'
Skipped
'
),
(
b
'
L
'
,
b
'
Cancelled
'
)])),
(
'
status
'
,
models
.
CharField
(
default
=
b
'
N
'
,
max_length
=
1
,
choices
=
[(
b
'
N
'
,
b
'
Queued
'
),
(
b
'
P
'
,
b
'
Processing
'
),
(
b
'
C
'
,
b
'
Completed
'
),
(
b
'
F
'
,
b
'
Failed
'
),
(
b
'
S
'
,
b
'
Skipped
'
),
(
b
'
L
'
,
b
'
Cancelled
'
)
,
(
b
'
K
'
,
b
'
Kill
'
)
])),
(
'
start_date
'
,
models
.
DateTimeField
(
null
=
True
)),
(
'
start_date
'
,
models
.
DateTimeField
(
null
=
True
)),
(
'
end_date
'
,
models
.
DateTimeField
(
null
=
True
)),
(
'
end_date
'
,
models
.
DateTimeField
(
null
=
True
)),
(
'
process_id
'
,
models
.
PositiveIntegerField
(
null
=
True
)),
(
'
process_id
'
,
models
.
PositiveIntegerField
(
null
=
True
)),
...
...
This diff is collapsed.
Click to expand it.
beat/web/backend/models.py
+
5
−
3
View file @
27344682
...
@@ -472,6 +472,7 @@ class Job(models.Model):
...
@@ -472,6 +472,7 @@ class Job(models.Model):
FAILED
=
'
F
'
#Block.FAILED
FAILED
=
'
F
'
#Block.FAILED
SKIPPED
=
'
S
'
#Block.SKIPPED
SKIPPED
=
'
S
'
#Block.SKIPPED
CANCELLED
=
'
L
'
#Block.CANCELLED
CANCELLED
=
'
L
'
#Block.CANCELLED
KILL
=
'
K
'
#Job was asked to be killed
STATUS
=
(
STATUS
=
(
(
QUEUED
,
'
Queued
'
),
(
QUEUED
,
'
Queued
'
),
...
@@ -701,7 +702,8 @@ class Job(models.Model):
...
@@ -701,7 +702,8 @@ class Job(models.Model):
elif
(
Job
.
PROCESSING
in
split_statuses
)
or
\
elif
(
Job
.
PROCESSING
in
split_statuses
)
or
\
(
Job
.
QUEUED
in
split_statuses
and
\
(
Job
.
QUEUED
in
split_statuses
and
\
Job
.
COMPLETED
in
split_statuses
):
Job
.
COMPLETED
in
split_statuses
)
or
\
(
Job
.
KILL
in
split_statuses
):
self
.
status
=
Job
.
PROCESSING
self
.
status
=
Job
.
PROCESSING
elif
all
([
s
==
Job
.
SKIPPED
for
s
in
split_statuses
]):
elif
all
([
s
==
Job
.
SKIPPED
for
s
in
split_statuses
]):
...
@@ -925,8 +927,8 @@ class JobSplit(models.Model):
...
@@ -925,8 +927,8 @@ class JobSplit(models.Model):
JobSplit
.
objects
.
select_for_update
().
filter
(
pk
=
self
.
pk
)
JobSplit
.
objects
.
select_for_update
().
filter
(
pk
=
self
.
pk
)
# If this split is running, then wait
# If this split is running, then wait
if
self
.
status
==
Job
.
PROCESSING
and
(
self
.
process_id
is
not
None
)
:
if
self
.
status
==
Job
.
PROCESSING
:
self
.
status
=
Job
.
CANCELLED
self
.
status
=
Job
.
KILL
self
.
save
()
self
.
save
()
logger
.
info
(
"
Job split `%s
'
is currently processing. Waiting
"
\
logger
.
info
(
"
Job split `%s
'
is currently processing. Waiting
"
\
"
for worker to cancel split remotely.
"
,
self
)
"
for worker to cancel split remotely.
"
,
self
)
...
...
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