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
Alexander Emmerich
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
Hide 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():
instance_title
=
"Scalability-"
instance_title
+=
"("
+
test_suite_title
+
")-"
instance_title
+=
str
(
self
.
involved_nodes_computer_guid
).
replace
(
"'"
,
""
)
instance_title
+=
"-"
instance_title
+=
time
.
strftime
(
'%d/%m/%y_%H:%M:%S'
,
time
.
local
time
())
instance_title
+=
"-"
+
str
(
datetime
.
now
().
isoformat
())
+
"-"
instance_title
+=
"timestamp="
+
str
(
time
.
time
())
return
instance_title
def
_generateInstanceXML
(
self
,
software_configuration
,
...
...
@@ -417,6 +417,9 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
self
.
slapos_controler
.
stopInstance
(
self
.
instance_title
)
self
.
_waitInstance
(
self
.
instance_title
,
'stopped'
)
#self.slapos_controler.destroyInstance(self.instance_title)
# Delete old instances
self
.
_cleanUpOldInstance
()
if
error
:
test_result_proxy
.
fail
()
...
...
@@ -425,7 +428,32 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
#test_result_proxy.stop()
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
):
self
.
involved_nodes_computer_guid
=
[]
self
.
launcher_nodes_computer_guid
=
[]
...
...
erp5/util/testnode/SlapOSControler.py
View file @
cc58dcca
...
...
@@ -151,7 +151,6 @@ class SlapOSControler(object):
"""
self
.
log
(
'SlapOSControler : request-->SlapOSMaster'
)
import
pdb
;
pdb
.
set_trace
()
current_intance_config
=
{
'software_type'
:
software_type
,
'software_configuration'
:
software_configuration
,
'computer_guid'
:
computer_guid
,
...
...
@@ -180,6 +179,8 @@ class SlapOSControler(object):
filter_kw
=
filter_kw
,
state
=
state
)
self
.
instance_config
[
reference
][
'partition'
]
=
partition
if
state
==
'destroyed'
:
del
self
.
instance_config
[
reference
]
except
:
self
.
log
(
"SlapOSControler.request,
\
exception in registerOpenOrder"
,
exc_info
=
sys
.
exc_info
())
...
...
@@ -200,7 +201,6 @@ class SlapOSControler(object):
self
.
log
(
'SlapOSControler : delete instance'
)
try
:
self
.
_requestSpecificState
(
reference
,
'destroyed'
)
del
self
.
instance_config
[
reference
]
except
:
raise
ValueError
(
"Can't delete instance '%s' (instance may not been created?)"
%
reference
)
...
...
@@ -227,7 +227,7 @@ class SlapOSControler(object):
self
.
log
(
'SlapOSControler : updateInstanceXML will request same'
'instance with new XML configuration...'
)
try
:
try
:
self
.
request
(
reference
,
self
.
instance_config
[
reference
][
'software_url'
],
self
.
instance_config
[
reference
][
'software_type'
],
...
...
erp5/util/testnode/SlapOSMasterCommunicator.py
View file @
cc58dcca
...
...
@@ -101,7 +101,7 @@ class SlapOSMasterCommunicator(object):
hosting_subscription
=
self
.
_curl
(
hosting_subscription_link
)
self
.
hosting_subcriptions_dict
.
update
({
hosting_subscription
[
'title'
]:
hosting_subscription_link
})
self
.
visited_hosting_subcriptions_link_list
.
append
(
hosting_subscription_link
)
def
_getRelatedInstanceLink
(
self
,
hosting_subscription_title
):
"""
Return a list of all related instance_url from an hosting_subscription_title
...
...
@@ -171,11 +171,34 @@ class SlapOSMasterCommunicator(object):
return
True
return
False
def
get
AliveHostingSubscription
(
self
,
prefix_title
):
def
get
HostingSubscriptionDict
(
self
):
"""
Return
list of dict information of alive hosting subscrtion
Return
the dict of hosting subcription.
"""
return
[]
return
self
.
hosting_subcriptions_dict
\ No newline at end of file
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