Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d3ff7402
authored
May 05, 2014
by
Őry Máté
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: add activity cleanup code
parent
16a0b9a6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
circle/storage/models.py
+10
-0
No files found.
circle/storage/models.py
View file @
d3ff7402
...
...
@@ -24,6 +24,7 @@ import logging
from
os.path
import
join
import
uuid
from
celery.signals
import
worker_ready
from
django.db.models
import
(
Model
,
CharField
,
DateTimeField
,
ForeignKey
)
from
django.utils
import
timezone
...
...
@@ -631,3 +632,12 @@ def disk_activity(code_suffix, disk, task_uuid=None, user=None,
on_abort
=
None
,
on_commit
=
None
):
act
=
DiskActivity
.
create
(
code_suffix
,
disk
,
task_uuid
,
user
)
return
activitycontextimpl
(
act
,
on_abort
=
on_abort
,
on_commit
=
on_commit
)
@worker_ready.connect
()
def
cleanup
(
conf
=
None
,
**
kwargs
):
# TODO check if other manager workers are running
for
i
in
DiskActivity
.
objects
.
filter
(
finished__isnull
=
True
):
i
.
finish
(
False
,
"Manager is restarted, activity is cleaned up. "
"You can try again now."
)
logger
.
error
(
'Forced finishing stale activity
%
s'
,
i
)
Guba Sándor
@gubasandor
commented
May 05, 2014
Owner
👍
:+1:
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment