Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6c57a9c6
authored
Jun 13, 2014
by
Guba Sándor
Committed by
Őry Máté
Jun 13, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: refactored remote_tasks to storage_tasks
parent
782bd27a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
circle/storage/tasks/periodic_tasks.py
+6
-6
No files found.
circle/storage/tasks/periodic_tasks.py
View file @
6c57a9c6
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
from
storage.models
import
DataStore
from
storage.models
import
DataStore
from
manager.mancelery
import
celery
from
manager.mancelery
import
celery
import
logging
import
logging
from
storage.tasks
import
remot
e_tasks
from
storage.tasks
import
storag
e_tasks
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
@@ -35,17 +35,17 @@ def garbage_collector(timeout=15):
...
@@ -35,17 +35,17 @@ def garbage_collector(timeout=15):
"""
"""
for
ds
in
DataStore
.
objects
.
all
():
for
ds
in
DataStore
.
objects
.
all
():
queue_name
=
ds
.
get_remote_queue_name
(
'storage'
,
priority
=
'fast'
)
queue_name
=
ds
.
get_remote_queue_name
(
'storage'
,
priority
=
'fast'
)
files
=
set
(
remot
e_tasks
.
list_files
.
apply_async
(
files
=
set
(
storag
e_tasks
.
list_files
.
apply_async
(
args
=
[
ds
.
path
],
queue
=
queue_name
)
.
get
(
timeout
=
timeout
))
args
=
[
ds
.
path
],
queue
=
queue_name
)
.
get
(
timeout
=
timeout
))
disks
=
set
(
ds
.
get_deletable_disks
())
disks
=
set
(
ds
.
get_deletable_disks
())
queue_name
=
ds
.
get_remote_queue_name
(
'storage'
,
priority
=
'slow'
)
queue_name
=
ds
.
get_remote_queue_name
(
'storage'
,
priority
=
'slow'
)
for
i
in
disks
&
files
:
for
i
in
disks
&
files
:
logger
.
info
(
"Image:
%
s at Datastore:
%
s moved to trash folder."
%
logger
.
info
(
"Image:
%
s at Datastore:
%
s moved to trash folder."
%
(
i
,
ds
.
path
))
(
i
,
ds
.
path
))
remot
e_tasks
.
move_to_trash
.
apply_async
(
storag
e_tasks
.
move_to_trash
.
apply_async
(
args
=
[
ds
.
path
,
i
],
queue
=
queue_name
)
.
get
(
timeout
=
timeout
)
args
=
[
ds
.
path
,
i
],
queue
=
queue_name
)
.
get
(
timeout
=
timeout
)
try
:
try
:
remot
e_tasks
.
make_free_space
.
apply_async
(
storag
e_tasks
.
make_free_space
.
apply_async
(
args
=
[
ds
.
path
],
queue
=
queue_name
)
.
get
(
timeout
=
timeout
)
args
=
[
ds
.
path
],
queue
=
queue_name
)
.
get
(
timeout
=
timeout
)
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
warning
(
str
(
e
))
logger
.
warning
(
str
(
e
))
...
@@ -63,7 +63,7 @@ def list_orphan_disks(timeout=15):
...
@@ -63,7 +63,7 @@ def list_orphan_disks(timeout=15):
import
re
import
re
for
ds
in
DataStore
.
objects
.
all
():
for
ds
in
DataStore
.
objects
.
all
():
queue_name
=
ds
.
get_remote_queue_name
(
'storage'
)
queue_name
=
ds
.
get_remote_queue_name
(
'storage'
)
files
=
set
(
remot
e_tasks
.
list_files
.
apply_async
(
files
=
set
(
storag
e_tasks
.
list_files
.
apply_async
(
args
=
[
ds
.
path
],
queue
=
queue_name
)
.
get
(
timeout
=
timeout
))
args
=
[
ds
.
path
],
queue
=
queue_name
)
.
get
(
timeout
=
timeout
))
disks
=
set
([
disk
.
filename
for
disk
in
ds
.
disk_set
.
all
()])
disks
=
set
([
disk
.
filename
for
disk
in
ds
.
disk_set
.
all
()])
for
i
in
files
-
disks
:
for
i
in
files
-
disks
:
...
@@ -80,7 +80,7 @@ def list_missing_disks(timeout=15):
...
@@ -80,7 +80,7 @@ def list_missing_disks(timeout=15):
"""
"""
for
ds
in
DataStore
.
objects
.
all
():
for
ds
in
DataStore
.
objects
.
all
():
queue_name
=
ds
.
get_remote_queue_name
(
'storage'
)
queue_name
=
ds
.
get_remote_queue_name
(
'storage'
)
files
=
set
(
remot
e_tasks
.
list_files
.
apply_async
(
files
=
set
(
storag
e_tasks
.
list_files
.
apply_async
(
args
=
[
ds
.
path
],
queue
=
queue_name
)
.
get
(
timeout
=
timeout
))
args
=
[
ds
.
path
],
queue
=
queue_name
)
.
get
(
timeout
=
timeout
))
disks
=
set
([
disk
.
filename
for
disk
in
disks
=
set
([
disk
.
filename
for
disk
in
ds
.
disk_set
.
filter
(
destroyed__isnull
=
True
)])
ds
.
disk_set
.
filter
(
destroyed__isnull
=
True
)])
...
...
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