Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
amrani
erp5
Commits
cc58dcca
Commit
cc58dcca
authored
Aug 23, 2013
by
Benjamin Blanc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testnode: delete scalability instance older than 2 days
parent
1582bfeb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
11 deletions
+62
-11
erp5/util/testnode/ScalabilityTestRunner.py
erp5/util/testnode/ScalabilityTestRunner.py
+30
-2
erp5/util/testnode/SlapOSControler.py
erp5/util/testnode/SlapOSControler.py
+3
-3
erp5/util/testnode/SlapOSMasterCommunicator.py
erp5/util/testnode/SlapOSMasterCommunicator.py
+29
-6
No files found.
erp5/util/testnode/ScalabilityTestRunner.py
View file @
cc58dcca
...
@@ -114,8 +114,8 @@ class ScalabilityTestRunner():
...
@@ -114,8 +114,8 @@ class ScalabilityTestRunner():
instance_title
=
"Scalability-"
instance_title
=
"Scalability-"
instance_title
+=
"("
+
test_suite_title
+
")-"
instance_title
+=
"("
+
test_suite_title
+
")-"
instance_title
+=
str
(
self
.
involved_nodes_computer_guid
).
replace
(
"'"
,
""
)
instance_title
+=
str
(
self
.
involved_nodes_computer_guid
).
replace
(
"'"
,
""
)
instance_title
+=
"-"
instance_title
+=
"-"
+
str
(
datetime
.
now
().
isoformat
())
+
"-"
instance_title
+=
time
.
strftime
(
'%d/%m/%y_%H:%M:%S'
,
time
.
local
time
())
instance_title
+=
"timestamp="
+
str
(
time
.
time
())
return
instance_title
return
instance_title
def
_generateInstanceXML
(
self
,
software_configuration
,
def
_generateInstanceXML
(
self
,
software_configuration
,
...
@@ -418,6 +418,9 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
...
@@ -418,6 +418,9 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
self
.
_waitInstance
(
self
.
instance_title
,
'stopped'
)
self
.
_waitInstance
(
self
.
instance_title
,
'stopped'
)
#self.slapos_controler.destroyInstance(self.instance_title)
#self.slapos_controler.destroyInstance(self.instance_title)
# Delete old instances
self
.
_cleanUpOldInstance
()
if
error
:
if
error
:
test_result_proxy
.
fail
()
test_result_proxy
.
fail
()
raise
error
raise
error
...
@@ -426,6 +429,31 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
...
@@ -426,6 +429,31 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
return
{
'status_code'
:
0
}
return
{
'status_code'
:
0
}
def
_cleanUpOldInstance
(
self
):
# Get link list of instances to delete
instance_dict
=
self
.
slapos_communicator
.
getHostingSubscriptionDict
()
instance_to_delete_list
=
[]
outdated_date
=
datetime
.
fromtimestamp
(
time
.
time
())
-
timedelta
(
days
=
2
)
for
title
,
link
in
instance_dict
.
items
():
if
"Scalability-"
in
title
and
"timestamp="
in
title
:
foo
,
timestamp
=
title
.
split
(
"timestamp="
)
creation_date
=
datetime
.
fromtimestamp
(
timestamp
)
if
creation_date
<
outdated_date
:
instance_to_delete_list
.
append
((
title
,
link
))
for
title
,
link
in
instance_to_delete_list
:
# Get instance information
instance_information_dict
=
self
.
slapos_communicator
.
getHostingSubscriptionInformation
(
link
)
# Delete instance
if
instance_information_dict
:
self
.
slapos_controler
.
request
(
instance_information_dict
[
'title'
],
instance_information_dict
[
'software_url'
],
software_type
=
instance_information_dict
[
'software_type'
],
computer_guid
=
instance_information_dict
[
'computer_guid'
],
state
=
'destroyed'
)
def
_cleanUpNodesInformation
(
self
):
def
_cleanUpNodesInformation
(
self
):
self
.
involved_nodes_computer_guid
=
[]
self
.
involved_nodes_computer_guid
=
[]
self
.
launcher_nodes_computer_guid
=
[]
self
.
launcher_nodes_computer_guid
=
[]
...
...
erp5/util/testnode/SlapOSControler.py
View file @
cc58dcca
...
@@ -151,7 +151,6 @@ class SlapOSControler(object):
...
@@ -151,7 +151,6 @@ class SlapOSControler(object):
"""
"""
self
.
log
(
'SlapOSControler : request-->SlapOSMaster'
)
self
.
log
(
'SlapOSControler : request-->SlapOSMaster'
)
import
pdb
;
pdb
.
set_trace
()
current_intance_config
=
{
'software_type'
:
software_type
,
current_intance_config
=
{
'software_type'
:
software_type
,
'software_configuration'
:
software_configuration
,
'software_configuration'
:
software_configuration
,
'computer_guid'
:
computer_guid
,
'computer_guid'
:
computer_guid
,
...
@@ -180,6 +179,8 @@ class SlapOSControler(object):
...
@@ -180,6 +179,8 @@ class SlapOSControler(object):
filter_kw
=
filter_kw
,
filter_kw
=
filter_kw
,
state
=
state
)
state
=
state
)
self
.
instance_config
[
reference
][
'partition'
]
=
partition
self
.
instance_config
[
reference
][
'partition'
]
=
partition
if
state
==
'destroyed'
:
del
self
.
instance_config
[
reference
]
except
:
except
:
self
.
log
(
"SlapOSControler.request,
\
self
.
log
(
"SlapOSControler.request,
\
exception in registerOpenOrder"
,
exc_info
=
sys
.
exc_info
())
exception in registerOpenOrder"
,
exc_info
=
sys
.
exc_info
())
...
@@ -200,7 +201,6 @@ class SlapOSControler(object):
...
@@ -200,7 +201,6 @@ class SlapOSControler(object):
self
.
log
(
'SlapOSControler : delete instance'
)
self
.
log
(
'SlapOSControler : delete instance'
)
try
:
try
:
self
.
_requestSpecificState
(
reference
,
'destroyed'
)
self
.
_requestSpecificState
(
reference
,
'destroyed'
)
del
self
.
instance_config
[
reference
]
except
:
except
:
raise
ValueError
(
"Can't delete instance '%s' (instance may not been created?)"
%
reference
)
raise
ValueError
(
"Can't delete instance '%s' (instance may not been created?)"
%
reference
)
...
...
erp5/util/testnode/SlapOSMasterCommunicator.py
View file @
cc58dcca
...
@@ -171,11 +171,34 @@ class SlapOSMasterCommunicator(object):
...
@@ -171,11 +171,34 @@ class SlapOSMasterCommunicator(object):
return
True
return
True
return
False
return
False
def
getAliveHostingSubscription
(
self
,
prefix_title
):
def
getHostingSubscriptionDict
(
self
):
"""
"""
Return list of dict information of alive hosting subscrtion
Return the dict of hosting subcription.
"""
"""
return
[]
return
self
.
hosting_subcriptions_dict
def
getHostingSubscriptionInformationDict
(
self
,
title
):
"""
Return a dict with informations about Hosting subscription
"""
related_instance_link_list
=
self
.
_getRelatedInstanceLink
(
title
)
related_instance_link
=
None
# Get root instance
for
link
in
related_instance_link_list
:
instance
=
self
.
_curl
(
link
)
if
tile
==
instance
[
'title'
]:
related_instance_link
=
link
break
# Return information dict
if
related_instance_link
:
related_instance
=
self
.
_curl
(
related_instance_link
)
return
{
'title'
:
related_instance
[
'title'
],
'status'
:
related_instance
[
'status'
],
'software_url'
:
related_instance
[
'_links'
][
'http://slapos.org/reg/release'
],
'software_type'
:
related_instance
[
'software_type'
],
'computer_guid'
:
related_instance
[
'sla'
][
'computer_guid'
]
}
else
:
return
None
\ No newline at end of file
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