Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
configuration
Commits
85a9d13e
Commit
85a9d13e
authored
Jan 13, 2014
by
John Jarvis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pep8
parent
eab2729e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
util/vpc-tools/abbey.py
+7
-8
No files found.
util/vpc-tools/abbey.py
View file @
85a9d13e
...
@@ -4,6 +4,7 @@ import sys
...
@@ -4,6 +4,7 @@ import sys
from
argparse
import
ArgumentParser
from
argparse
import
ArgumentParser
import
time
import
time
import
json
import
json
import
yaml
try
:
try
:
import
boto.ec2
import
boto.ec2
import
boto.sqs
import
boto.sqs
...
@@ -23,6 +24,7 @@ EC2_RUN_TIMEOUT = 180 # time to wait for ec2 state transition
...
@@ -23,6 +24,7 @@ EC2_RUN_TIMEOUT = 180 # time to wait for ec2 state transition
EC2_STATUS_TIMEOUT
=
300
# time to wait for ec2 system status checks
EC2_STATUS_TIMEOUT
=
300
# time to wait for ec2 system status checks
NUM_TASKS
=
5
# number of tasks for time summary report
NUM_TASKS
=
5
# number of tasks for time summary report
class
MongoConnection
:
class
MongoConnection
:
def
__init__
(
self
):
def
__init__
(
self
):
...
@@ -34,7 +36,8 @@ class MongoConnection:
...
@@ -34,7 +36,8 @@ class MongoConnection:
if
args
.
mongo_deployment_collection
not
in
mongo_db
.
collection_names
():
if
args
.
mongo_deployment_collection
not
in
mongo_db
.
collection_names
():
mongo_db
.
create_collection
(
args
.
mongo_deployment_collection
)
mongo_db
.
create_collection
(
args
.
mongo_deployment_collection
)
self
.
mongo_ami
=
getattr
(
mongo_db
,
args
.
mongo_ami_collection
)
self
.
mongo_ami
=
getattr
(
mongo_db
,
args
.
mongo_ami_collection
)
self
.
mongo_deployment
=
getattr
(
mongo_db
,
args
.
mongo_deployment_collection
)
self
.
mongo_deployment
=
getattr
(
mongo_db
,
args
.
mongo_deployment_collection
)
self
.
query
=
{
self
.
query
=
{
'play'
:
args
.
play
,
'play'
:
args
.
play
,
...
@@ -55,7 +58,6 @@ class MongoConnection:
...
@@ -55,7 +58,6 @@ class MongoConnection:
or updates an existing one with a status
or updates an existing one with a status
"""
"""
update
=
self
.
query
.
copy
()
update
=
self
.
query
.
copy
()
update
[
'status'
]
=
status
update
[
'status'
]
=
status
if
ami
:
if
ami
:
...
@@ -81,7 +83,6 @@ class MongoConnection:
...
@@ -81,7 +83,6 @@ class MongoConnection:
self
.
mongo_deployment
.
update
(
query
,
update
,
True
)
self
.
mongo_deployment
.
update
(
query
,
update
,
True
)
class
Unbuffered
:
class
Unbuffered
:
"""
"""
For unbuffered output, not
For unbuffered output, not
...
@@ -469,6 +470,7 @@ def create_ami(instance_id, name, description):
...
@@ -469,6 +470,7 @@ def create_ami(instance_id, name, description):
return
image_id
return
image_id
def
launch_and_configure
(
ec2_args
):
def
launch_and_configure
(
ec2_args
):
"""
"""
Creates an sqs queue, launches an ec2 instance,
Creates an sqs queue, launches an ec2 instance,
...
@@ -484,7 +486,6 @@ def launch_and_configure(ec2_args):
...
@@ -484,7 +486,6 @@ def launch_and_configure(ec2_args):
print
" {:<25}{}"
.
format
(
k
,
v
)
print
" {:<25}{}"
.
format
(
k
,
v
)
print
print
sqs_queue
=
sqs
.
create_queue
(
run_id
)
sqs_queue
=
sqs
.
create_queue
(
run_id
)
sqs_queue
.
set_message_class
(
RawMessage
)
sqs_queue
.
set_message_class
(
RawMessage
)
res
=
ec2
.
run_instances
(
**
ec2_args
)
res
=
ec2
.
run_instances
(
**
ec2_args
)
...
@@ -524,14 +525,12 @@ def launch_and_configure(ec2_args):
...
@@ -524,14 +525,12 @@ def launch_and_configure(ec2_args):
else
:
else
:
raise
Exception
(
"Timeout waiting for status checks: {} "
.
format
(
raise
Exception
(
"Timeout waiting for status checks: {} "
.
format
(
instance_id
))
instance_id
))
user_start
=
time
.
time
()
print
print
print
"{:<40}"
.
format
(
print
"{:<40}"
.
format
(
"Waiting for user-data, polling sqs for Ansible events:"
)
"Waiting for user-data, polling sqs for Ansible events:"
)
(
ansible_delta
,
task_report
)
=
poll_sqs_ansible
()
(
ansible_delta
,
task_report
)
=
poll_sqs_ansible
()
user_pre_ansible
=
time
.
time
()
-
user_start
-
ansible_delta
run_summary
.
append
((
'Ansible run'
,
ansible_delta
))
run_summary
.
append
((
'Ansible run'
,
ansible_delta
))
print
print
print
"{} longest Ansible tasks (seconds):"
.
format
(
NUM_TASKS
)
print
"{} longest Ansible tasks (seconds):"
.
format
(
NUM_TASKS
)
...
@@ -596,7 +595,6 @@ if __name__ == '__main__':
...
@@ -596,7 +595,6 @@ if __name__ == '__main__':
mongo_con
=
MongoConnection
()
mongo_con
=
MongoConnection
()
mongo_con
.
update_ami
(
status
=
'Generating'
)
mongo_con
.
update_ami
(
status
=
'Generating'
)
try
:
try
:
sqs_queue
=
None
sqs_queue
=
None
instance_id
=
None
instance_id
=
None
...
@@ -607,7 +605,8 @@ if __name__ == '__main__':
...
@@ -607,7 +605,8 @@ if __name__ == '__main__':
ec2_args
=
create_instance_args
()
ec2_args
=
create_instance_args
()
if
args
.
noop
:
if
args
.
noop
:
print
"Would have created sqs_queue with id: {}
\n
ec2_args:"
.
format
(
run_id
)
print
"Would have created sqs_queue with id: {}
\n
ec2_args:"
.
format
(
run_id
)
pprint
(
ec2_args
)
pprint
(
ec2_args
)
ami
=
"ami-00000"
ami
=
"ami-00000"
else
:
else
:
...
...
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