Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
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
b0c990f1
authored
Mar 10, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
one: localize emails
parent
e2946a1e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
one/jobs/hourly/scheduled_vm_cleanup.py
+9
-0
No files found.
one/jobs/hourly/scheduled_vm_cleanup.py
View file @
b0c990f1
...
...
@@ -7,6 +7,7 @@ from django.template.loader import render_to_string
from
one.tasks
import
SendMailTask
from
django.utils.translation
import
ugettext_lazy
as
_
from
cloud.settings
import
CLOUD_URL
as
url
from
django.utils
import
translation
class
Job
(
HourlyJob
):
...
...
@@ -29,6 +30,10 @@ class Job(HourlyJob):
# delete
for
i
in
Instance
.
objects
.
filter
(
state__in
=
[
'ACTIVE'
,
'STOPPED'
],
time_of_delete__isnull
=
False
):
try
:
translation
.
activate
(
i
.
owner
.
person_set
.
get
()
.
language
)
except
:
pass
print
"
%
s delete:
%
s"
%
(
i
.
name
,
i
.
time_of_delete
)
delete
=
i
.
time_of_delete
.
replace
(
minute
=
0
,
second
=
0
,
microsecond
=
0
)
if
i
.
time_of_delete
<
now
:
...
...
@@ -43,6 +48,10 @@ class Job(HourlyJob):
# suspend
for
i
in
Instance
.
objects
.
filter
(
state
=
'ACTIVE'
,
time_of_suspend__isnull
=
False
):
try
:
translation
.
activate
(
i
.
owner
.
person_set
.
get
()
.
language
)
except
:
pass
print
"
%
s suspend:
%
s"
%
(
i
.
name
,
i
.
time_of_suspend
)
suspend
=
i
.
time_of_suspend
.
replace
(
minute
=
0
,
second
=
0
,
microsecond
=
0
)
...
...
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