@@ -85,22 +85,24 @@ def validate_lambda_role_name(role_name):
85
85
# FIXME
86
86
return True
87
87
88
- def ds (key ):
89
- """
90
- Debug suffix for defaults. For automated testing,
91
- automatically adds a suffix to each default
92
- """
93
- env_var = 'PYWREN_SETUP_INTERACTIVE_DEBUG_SUFFIX'
94
- suffix = os .environ .get (env_var , "" )
95
- return "{}{}" .format (key , suffix )
96
-
97
88
@click .command ()
98
89
@click .option ('--dryrun' , default = False , is_flag = True , type = bool ,
99
90
help = 'create config file but take no actions' )
91
+ @click .option ('--suffix' , default = "" , type = str ,
92
+ help = "suffix to use for all automatically-generated named entities, useful for helping with IAM roles, and automated testing" )
100
93
@click .pass_context
101
- def interactive_setup (ctx , dryrun ):
94
+ def interactive_setup (ctx , dryrun , suffix ):
95
+
96
+
97
+ def ds (key ):
98
+ """
99
+ Debug suffix for defaults. For automated testing,
100
+ automatically adds a suffix to each default
101
+ """
102
+ return "{}{}" .format (key , suffix )
103
+
102
104
103
- click .echo ("This is the pywren interactive setup script" )
105
+ click .echo ("This is the PyWren interactive setup script" )
104
106
try :
105
107
#first we will try and make sure AWS is set up
106
108
@@ -109,8 +111,8 @@ def interactive_setup(ctx, dryrun):
109
111
except Exception as e :
110
112
raise
111
113
112
- click .echo ("This interactive script will set up your initial pywren configuration." )
113
- click .echo ("If this is your first time using pywren then accepting the defaults should be fine" )
114
+ click .echo ("This interactive script will set up your initial PyWren configuration." )
115
+ click .echo ("If this is your first time using PyWren then accepting the defaults should be fine. " )
114
116
115
117
# first, what is your default AWS region?
116
118
aws_region = click_validate_prompt ("What is your default aws region?" ,
@@ -128,15 +130,15 @@ def interactive_setup(ctx, dryrun):
128
130
validate_func = check_overwrite_function )
129
131
config_filename = os .path .expanduser (config_filename )
130
132
131
- s3_bucket = click_validate_prompt ("pywren requires an s3 bucket to store intermediate data. What s3 bucket would you like to use?" ,
133
+ s3_bucket = click_validate_prompt ("PyWren requires an s3 bucket to store intermediate data. What s3 bucket would you like to use?" ,
132
134
default = create_unique_bucket_name (),
133
135
validate_func = check_valid_bucket_name )
134
136
create_bucket = False
135
137
if not check_bucket_exists (s3_bucket ):
136
138
create_bucket = click .confirm ("Bucket does not currently exist, would you like to create it?" , default = True )
137
139
138
- click .echo ("Pywren prefixes every object it puts in S3 with a particular prefix" )
139
- bucket_pywren_prefix = click_validate_prompt ("pywren s3 prefix: " ,
140
+ click .echo ("PyWren prefixes every object it puts in S3 with a particular prefix. " )
141
+ bucket_pywren_prefix = click_validate_prompt ("PyWren s3 prefix: " ,
140
142
default = pywren .wrenconfig .AWS_S3_PREFIX_DEFAULT ,
141
143
validate_func = validate_s3_prefix )
142
144
@@ -154,8 +156,8 @@ def interactive_setup(ctx, dryrun):
154
156
"What is your function name?" ,
155
157
default = function_name ,
156
158
validate_func = validate_lambda_function_name )
157
- click .echo ("pywren standalone mode uses dedicated AWS instances to run pywren tasks. This is more flexible, but more expensive with fewer simultaneous workers." )
158
- use_standalone = click .confirm ("Would you like to enable pywren standalone mode?" )
159
+ click .echo ("PyWren standalone mode uses dedicated AWS instances to run PyWren tasks. This is more flexible, but more expensive with fewer simultaneous workers." )
160
+ use_standalone = click .confirm ("Would you like to enable PyWren standalone mode?" )
159
161
160
162
click .echo ("Creating config {}" .format (config_filename ))
161
163
ctx .obj = {"config_filename" : config_filename }
@@ -167,22 +169,22 @@ def interactive_setup(ctx, dryrun):
167
169
bucket_prefix = bucket_pywren_prefix ,
168
170
force = True )
169
171
if dryrun :
170
- click .echo ("dryrun is set, not manipulating cloud state" )
172
+ click .echo ("dryrun is set, not manipulating cloud state. " )
171
173
return
172
174
173
175
if create_bucket :
174
- click .echo ("Creating bucket {}" .format (s3_bucket ))
176
+ click .echo ("Creating bucket {}. " .format (s3_bucket ))
175
177
ctx .invoke (pywrencli .create_bucket )
176
- click .echo ("Creating role" )
178
+ click .echo ("Creating role. " )
177
179
ctx .invoke (pywrencli .create_role )
178
- click .echo ("deploying lambda" )
180
+ click .echo ("Deploying lambda. " )
179
181
ctx .invoke (pywrencli .deploy_lambda )
180
182
181
183
if use_standalone :
182
- click .echo ("setting up standalone mode" )
184
+ click .echo ("Setting up standalone mode. " )
183
185
ctx .invoke (pywrencli .create_queue )
184
186
ctx .invoke (pywrencli .create_instance_profile )
185
- click .echo ("pausing for 10 sec for changes to propoagate" )
187
+ click .echo ("Pausing for 10 sec for changes to propoagate. " )
186
188
time .sleep (10 )
187
189
ctx .invoke (pywrencli .test_function )
188
190
0 commit comments