oration 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/Generator.html +18 -101
- data/doc/created.rid +2 -2
- data/doc/index.html +0 -4
- data/doc/lib/generator_rb.html +1 -1
- data/lib/generator.rb +9 -30
- data/templates/main.go +4 -5
- data/templates/main.py +12 -5
- data/test/test_generator.rb +0 -30
- metadata +4 -4
data/doc/Generator.html
CHANGED
@@ -70,10 +70,6 @@
|
|
70
70
|
|
71
71
|
<li><a href="#method-c-generate_python_app">::generate_python_app</a></li>
|
72
72
|
|
73
|
-
<li><a href="#method-c-get_go_function">::get_go_function</a></li>
|
74
|
-
|
75
|
-
<li><a href="#method-c-get_python_function">::get_python_function</a></li>
|
76
|
-
|
77
73
|
<li><a href="#method-c-write_go_app_yaml_file">::write_go_app_yaml_file</a></li>
|
78
74
|
|
79
75
|
<li><a href="#method-c-write_go_cicero_code">::write_go_cicero_code</a></li>
|
@@ -163,7 +159,7 @@ new directory we are making for their App Engine app.</p>
|
|
163
159
|
<div class="method-source-code"
|
164
160
|
id="copy_app_files-source">
|
165
161
|
<pre>
|
166
|
-
<span class="ruby-comment"># File lib/generator.rb, line
|
162
|
+
<span class="ruby-comment"># File lib/generator.rb, line 164</span>
|
167
163
|
def self.copy_app_files(main_file, output_dir, fileutils=<span class="ruby-constant">FileUtils</span>)
|
168
164
|
source_dir = <span class="ruby-constant">File</span>.dirname(main_file) + <span class="ruby-string">"/."</span>
|
169
165
|
<span class="ruby-constant">FileUtils</span>.cp_r(source_dir, output_dir)
|
@@ -243,7 +239,7 @@ end</pre>
|
|
243
239
|
|
244
240
|
<div class="method-heading">
|
245
241
|
<span class="method-name">generate_go_app</span><span
|
246
|
-
class="method-args">(main_file, function_name, output_dir, app_id,
|
242
|
+
class="method-args">(main_file, function_name, output_dir, app_id, make_directory=FileUtils.method(:mkdir_p), write_go_app_yaml=Generator.method(:write_go_app_yaml_file), write_go_cicero_code=Generator.method(:write_go_cicero_code), copy_app_files=Generator.method(:copy_app_files))</span>
|
247
243
|
<span class="method-click-advice">click to toggle source</span>
|
248
244
|
</div>
|
249
245
|
|
@@ -258,21 +254,20 @@ function that the user specified.</p>
|
|
258
254
|
<div class="method-source-code"
|
259
255
|
id="generate_go_app-source">
|
260
256
|
<pre>
|
261
|
-
<span class="ruby-comment"># File lib/generator.rb, line
|
257
|
+
<span class="ruby-comment"># File lib/generator.rb, line 63</span>
|
262
258
|
def self.generate_go_app(main_file, function_name, output_dir, app_id,
|
263
|
-
get_go_function=<span class="ruby-constant">Generator</span>.method(:get_go_function),
|
264
259
|
make_directory=<span class="ruby-constant">FileUtils</span>.method(:mkdir_p),
|
265
260
|
write_go_app_yaml=<span class="ruby-constant">Generator</span>.method(:write_go_app_yaml_file),
|
266
|
-
write_go_cicero_code=<span class="ruby-constant">Generator</span>.method(:write_go_cicero_code)
|
261
|
+
write_go_cicero_code=<span class="ruby-constant">Generator</span>.method(:write_go_cicero_code),
|
262
|
+
copy_app_files=<span class="ruby-constant">Generator</span>.method(:copy_app_files))
|
267
263
|
|
268
|
-
function = get_go_function.call(main_file, function_name)
|
269
264
|
make_directory.call(output_dir)
|
270
|
-
|
271
265
|
go_code_folder = output_dir + <span class="ruby-constant">File</span>::<span class="ruby-constant">Separator</span> + function_name
|
272
266
|
make_directory.call(go_code_folder)
|
273
267
|
|
274
268
|
write_go_app_yaml.call(app_id, output_dir)
|
275
|
-
write_go_cicero_code.call(
|
269
|
+
write_go_cicero_code.call(main_file, function_name, go_code_folder)
|
270
|
+
copy_app_files.call(main_file, go_code_folder)
|
276
271
|
end</pre>
|
277
272
|
</div>
|
278
273
|
|
@@ -290,7 +285,7 @@ end</pre>
|
|
290
285
|
|
291
286
|
<div class="method-heading">
|
292
287
|
<span class="method-name">generate_python_app</span><span
|
293
|
-
class="method-args">(main_file, function_name, output_dir, app_id,
|
288
|
+
class="method-args">(main_file, function_name, output_dir, app_id, make_directory=FileUtils.method(:mkdir_p), write_python_app_yaml=Generator.method(:write_python_app_yaml_file), write_python_cicero_code=Generator.method(:write_python_cicero_code), copy_app_files=Generator.method(:copy_app_files))</span>
|
294
289
|
<span class="method-click-advice">click to toggle source</span>
|
295
290
|
</div>
|
296
291
|
|
@@ -310,13 +305,11 @@ function.</p>
|
|
310
305
|
<pre>
|
311
306
|
<span class="ruby-comment"># File lib/generator.rb, line 49</span>
|
312
307
|
def self.generate_python_app(main_file, function_name, output_dir, app_id,
|
313
|
-
get_python_function=<span class="ruby-constant">Generator</span>.method(:get_python_function),
|
314
308
|
make_directory=<span class="ruby-constant">FileUtils</span>.method(:mkdir_p),
|
315
309
|
write_python_app_yaml=<span class="ruby-constant">Generator</span>.method(:write_python_app_yaml_file),
|
316
310
|
write_python_cicero_code=<span class="ruby-constant">Generator</span>.method(:write_python_cicero_code),
|
317
311
|
copy_app_files=<span class="ruby-constant">Generator</span>.method(:copy_app_files))
|
318
312
|
|
319
|
-
function = get_python_function.call(main_file, function_name)
|
320
313
|
make_directory.call(output_dir)
|
321
314
|
write_python_app_yaml.call(app_id, output_dir)
|
322
315
|
write_python_cicero_code.call(main_file, function_name, output_dir)
|
@@ -329,84 +322,6 @@ end</pre>
|
|
329
322
|
|
330
323
|
|
331
324
|
|
332
|
-
</div>
|
333
|
-
|
334
|
-
|
335
|
-
<div id="get_go_function-method" class="method-detail ">
|
336
|
-
<a name="method-c-get_go_function"></a>
|
337
|
-
|
338
|
-
|
339
|
-
<div class="method-heading">
|
340
|
-
<span class="method-name">get_go_function</span><span
|
341
|
-
class="method-args">(main_file, function_name, file=File)</span>
|
342
|
-
<span class="method-click-advice">click to toggle source</span>
|
343
|
-
</div>
|
344
|
-
|
345
|
-
|
346
|
-
<div class="method-description">
|
347
|
-
|
348
|
-
<p>Given a Go source code file to read, finds the named function and returns
|
349
|
-
everything at and after that method’s definition. TODO(cgb): Parse just
|
350
|
-
the function instead of everything in the file after where the function
|
351
|
-
starts.</p>
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
<div class="method-source-code"
|
356
|
-
id="get_go_function-source">
|
357
|
-
<pre>
|
358
|
-
<span class="ruby-comment"># File lib/generator.rb, line 139</span>
|
359
|
-
def self.get_go_function(main_file, function_name, file=<span class="ruby-constant">File</span>)
|
360
|
-
contents = file.open(main_file) { |f| f.read }
|
361
|
-
function = contents.scan(/(func #{function_name}(.|\n)*)/).flatten[0]
|
362
|
-
return function
|
363
|
-
end</pre>
|
364
|
-
</div>
|
365
|
-
|
366
|
-
</div>
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
</div>
|
372
|
-
|
373
|
-
|
374
|
-
<div id="get_python_function-method" class="method-detail ">
|
375
|
-
<a name="method-c-get_python_function"></a>
|
376
|
-
|
377
|
-
|
378
|
-
<div class="method-heading">
|
379
|
-
<span class="method-name">get_python_function</span><span
|
380
|
-
class="method-args">(main_file, function_name, file=File)</span>
|
381
|
-
<span class="method-click-advice">click to toggle source</span>
|
382
|
-
</div>
|
383
|
-
|
384
|
-
|
385
|
-
<div class="method-description">
|
386
|
-
|
387
|
-
<p>This method opens main_file and parses out the function named
|
388
|
-
function_name, returning a string with the contents of that function. We
|
389
|
-
assume that the user only has one function in their file right now after
|
390
|
-
zero or more import statements.</p>
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
<div class="method-source-code"
|
395
|
-
id="get_python_function-source">
|
396
|
-
<pre>
|
397
|
-
<span class="ruby-comment"># File lib/generator.rb, line 85</span>
|
398
|
-
def self.get_python_function(main_file, function_name, file=<span class="ruby-constant">File</span>)
|
399
|
-
contents = file.open(main_file) { |f| f.read }
|
400
|
-
function = contents.scan(/(def #{function_name}(.|\n)*)/).flatten[0]
|
401
|
-
return function
|
402
|
-
end</pre>
|
403
|
-
</div>
|
404
|
-
|
405
|
-
</div>
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
325
|
</div>
|
411
326
|
|
412
327
|
|
@@ -433,7 +348,7 @@ automatically put a nice UI on the / url.</p>
|
|
433
348
|
<div class="method-source-code"
|
434
349
|
id="write_go_app_yaml_file-source">
|
435
350
|
<pre>
|
436
|
-
<span class="ruby-comment"># File lib/generator.rb, line
|
351
|
+
<span class="ruby-comment"># File lib/generator.rb, line 126</span>
|
437
352
|
def self.write_go_app_yaml_file(app_id, output_dir, file=<span class="ruby-constant">File</span>)
|
438
353
|
app_yaml_contents = <span class="ruby-string">application: #{app_id.downcase}version: 1runtime: goapi_version: 3handlers:- url: /.* script: _go_app</span>
|
439
354
|
|
@@ -458,7 +373,7 @@ end</pre>
|
|
458
373
|
|
459
374
|
<div class="method-heading">
|
460
375
|
<span class="method-name">write_go_cicero_code</span><span
|
461
|
-
class="method-args">(
|
376
|
+
class="method-args">(file_name, function_name, output_dir, file=File)</span>
|
462
377
|
<span class="method-click-advice">click to toggle source</span>
|
463
378
|
</div>
|
464
379
|
|
@@ -473,15 +388,17 @@ the user’s function in it.</p>
|
|
473
388
|
<div class="method-source-code"
|
474
389
|
id="write_go_cicero_code-source">
|
475
390
|
<pre>
|
476
|
-
<span class="ruby-comment"># File lib/generator.rb, line
|
477
|
-
def self.write_go_cicero_code(
|
391
|
+
<span class="ruby-comment"># File lib/generator.rb, line 146</span>
|
392
|
+
def self.write_go_cicero_code(file_name, function_name, output_dir, file=<span class="ruby-constant">File</span>)
|
393
|
+
package_name = <span class="ruby-constant">File</span>.basename(file_name, <span class="ruby-string">".go"</span>)
|
478
394
|
template_location = <span class="ruby-constant">File</span>.join(<span class="ruby-constant">File</span>.dirname(__FILE__), <span class="ruby-string">".."</span>,
|
479
395
|
<span class="ruby-string">"templates"</span>, <span class="ruby-string">"main.go"</span>)
|
480
396
|
main_go_contents = file.open(template_location) { |f| f.read }
|
481
|
-
main_go_contents.gsub!(<span class="ruby-regexp">/CICERO_FUNCTION_CONTENTS/</span>, function)
|
482
397
|
main_go_contents.gsub!(<span class="ruby-regexp">/CICERO_FUNCTION_NAME/</span>, function_name)
|
483
|
-
main_go_contents.gsub!(<span class="ruby-regexp">/CICERO_PKG_NAME/</span>,
|
398
|
+
main_go_contents.gsub!(<span class="ruby-regexp">/CICERO_PKG_NAME/</span>, package_name)
|
484
399
|
|
400
|
+
invokable_name = package_name + <span class="ruby-string">"."</span> + function_name
|
401
|
+
main_go_contents.gsub!(<span class="ruby-regexp">/CICERO_PACKAGE_AND_FUNCTION_NAME/</span>, invokable_name)
|
485
402
|
main_go_location = file.expand_path(output_dir + <span class="ruby-constant">File</span>::<span class="ruby-constant">Separator</span> +
|
486
403
|
<span class="ruby-string">"main.go"</span>)
|
487
404
|
|
@@ -519,7 +436,7 @@ write those files in the given directory.</p>
|
|
519
436
|
<div class="method-source-code"
|
520
437
|
id="write_python_app_yaml_file-source">
|
521
438
|
<pre>
|
522
|
-
<span class="ruby-comment"># File lib/generator.rb, line
|
439
|
+
<span class="ruby-comment"># File lib/generator.rb, line 81</span>
|
523
440
|
def self.write_python_app_yaml_file(app_id, output_dir, file=<span class="ruby-constant">File</span>)
|
524
441
|
app_yaml_contents = <span class="ruby-string">application: #{app_id}version: 1runtime: pythonapi_version: 1handlers:- url: .* script: main.py</span>
|
525
442
|
|
@@ -561,7 +478,7 @@ placing them in as well.</p>
|
|
561
478
|
<div class="method-source-code"
|
562
479
|
id="write_python_cicero_code-source">
|
563
480
|
<pre>
|
564
|
-
<span class="ruby-comment"># File lib/generator.rb, line
|
481
|
+
<span class="ruby-comment"># File lib/generator.rb, line 103</span>
|
565
482
|
def self.write_python_cicero_code(file_name, function_name, output_dir,
|
566
483
|
file=<span class="ruby-constant">File</span>)
|
567
484
|
|
data/doc/created.rid
CHANGED
data/doc/index.html
CHANGED
@@ -50,10 +50,6 @@
|
|
50
50
|
|
51
51
|
<li><a href="Generator.html#method-c-generate_python_app">::generate_python_app — Generator</a></li>
|
52
52
|
|
53
|
-
<li><a href="Generator.html#method-c-get_go_function">::get_go_function — Generator</a></li>
|
54
|
-
|
55
|
-
<li><a href="Generator.html#method-c-get_python_function">::get_python_function — Generator</a></li>
|
56
|
-
|
57
53
|
<li><a href="Generator.html#method-c-write_go_app_yaml_file">::write_go_app_yaml_file — Generator</a></li>
|
58
54
|
|
59
55
|
<li><a href="Generator.html#method-c-write_go_cicero_code">::write_go_cicero_code — Generator</a></li>
|
data/doc/lib/generator_rb.html
CHANGED
data/lib/generator.rb
CHANGED
@@ -47,13 +47,11 @@ module Generator
|
|
47
47
|
# an app.yaml for the app, and a Python file containing our Cicero
|
48
48
|
# interface and their function.
|
49
49
|
def self.generate_python_app(main_file, function_name, output_dir, app_id,
|
50
|
-
get_python_function=Generator.method(:get_python_function),
|
51
50
|
make_directory=FileUtils.method(:mkdir_p),
|
52
51
|
write_python_app_yaml=Generator.method(:write_python_app_yaml_file),
|
53
52
|
write_python_cicero_code=Generator.method(:write_python_cicero_code),
|
54
53
|
copy_app_files=Generator.method(:copy_app_files))
|
55
54
|
|
56
|
-
function = get_python_function.call(main_file, function_name)
|
57
55
|
make_directory.call(output_dir)
|
58
56
|
write_python_app_yaml.call(app_id, output_dir)
|
59
57
|
write_python_cicero_code.call(main_file, function_name, output_dir)
|
@@ -63,29 +61,18 @@ module Generator
|
|
63
61
|
# This method generates a Go Google App Engine application containing
|
64
62
|
# the function that the user specified.
|
65
63
|
def self.generate_go_app(main_file, function_name, output_dir, app_id,
|
66
|
-
get_go_function=Generator.method(:get_go_function),
|
67
64
|
make_directory=FileUtils.method(:mkdir_p),
|
68
65
|
write_go_app_yaml=Generator.method(:write_go_app_yaml_file),
|
69
|
-
write_go_cicero_code=Generator.method(:write_go_cicero_code)
|
66
|
+
write_go_cicero_code=Generator.method(:write_go_cicero_code),
|
67
|
+
copy_app_files=Generator.method(:copy_app_files))
|
70
68
|
|
71
|
-
function = get_go_function.call(main_file, function_name)
|
72
69
|
make_directory.call(output_dir)
|
73
|
-
|
74
70
|
go_code_folder = output_dir + File::Separator + function_name
|
75
71
|
make_directory.call(go_code_folder)
|
76
72
|
|
77
73
|
write_go_app_yaml.call(app_id, output_dir)
|
78
|
-
write_go_cicero_code.call(
|
79
|
-
|
80
|
-
|
81
|
-
# This method opens main_file and parses out the function named
|
82
|
-
# function_name, returning a string with the contents of that
|
83
|
-
# function. We assume that the user only has one function in their
|
84
|
-
# file right now after zero or more import statements.
|
85
|
-
def self.get_python_function(main_file, function_name, file=File)
|
86
|
-
contents = file.open(main_file) { |f| f.read }
|
87
|
-
function = contents.scan(/(def #{function_name}(.|\n)*)/s).flatten[0]
|
88
|
-
return function
|
74
|
+
write_go_cicero_code.call(main_file, function_name, go_code_folder)
|
75
|
+
copy_app_files.call(main_file, go_code_folder)
|
89
76
|
end
|
90
77
|
|
91
78
|
# Writes an app.yaml file for use with Python Google App Engine applications.
|
@@ -132,16 +119,6 @@ YAML
|
|
132
119
|
file.open(main_py_location, "w+") { |file| file.write(main_py_contents) }
|
133
120
|
end
|
134
121
|
|
135
|
-
# Given a Go source code file to read, finds the named function and returns
|
136
|
-
# everything at and after that method's definition.
|
137
|
-
# TODO(cgb): Parse just the function instead of everything in the file after
|
138
|
-
# where the function starts.
|
139
|
-
def self.get_go_function(main_file, function_name, file=File)
|
140
|
-
contents = file.open(main_file) { |f| f.read }
|
141
|
-
function = contents.scan(/(func #{function_name}(.|\n)*)/s).flatten[0]
|
142
|
-
return function
|
143
|
-
end
|
144
|
-
|
145
122
|
# Writes an app.yaml file for use with Go Google App Engine applications.
|
146
123
|
# Right now, we direct all URL requests to the Go app we are about to
|
147
124
|
# construct, but in the future we may add support for jQuery and Bootstrap
|
@@ -166,14 +143,16 @@ YAML
|
|
166
143
|
|
167
144
|
# Writes a main.go function that is a Go Google App Engine application with
|
168
145
|
# the user's function in it.
|
169
|
-
def self.write_go_cicero_code(
|
146
|
+
def self.write_go_cicero_code(file_name, function_name, output_dir, file=File)
|
147
|
+
package_name = File.basename(file_name, ".go")
|
170
148
|
template_location = File.join(File.dirname(__FILE__), "..",
|
171
149
|
"templates", "main.go")
|
172
150
|
main_go_contents = file.open(template_location) { |f| f.read }
|
173
|
-
main_go_contents.gsub!(/CICERO_FUNCTION_CONTENTS/, function)
|
174
151
|
main_go_contents.gsub!(/CICERO_FUNCTION_NAME/, function_name)
|
175
|
-
main_go_contents.gsub!(/CICERO_PKG_NAME/,
|
152
|
+
main_go_contents.gsub!(/CICERO_PKG_NAME/, package_name)
|
176
153
|
|
154
|
+
invokable_name = package_name + "." + function_name
|
155
|
+
main_go_contents.gsub!(/CICERO_PACKAGE_AND_FUNCTION_NAME/, invokable_name)
|
177
156
|
main_go_location = file.expand_path(output_dir + File::Separator +
|
178
157
|
"main.go")
|
179
158
|
|
data/templates/main.go
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// BEGIN CICERO-BOILERPLATE CODE
|
2
|
-
package
|
2
|
+
package "main"
|
3
3
|
|
4
4
|
import (
|
5
5
|
"appengine"
|
@@ -11,6 +11,8 @@ import (
|
|
11
11
|
"time"
|
12
12
|
)
|
13
13
|
|
14
|
+
import "CICERO_PKG_NAME"
|
15
|
+
|
14
16
|
type TaskInfo struct {
|
15
17
|
State string
|
16
18
|
StartTime datastore.Time
|
@@ -181,7 +183,7 @@ func computeWorker(w http.ResponseWriter, r *http.Request) {
|
|
181
183
|
outputTextKeyName := outputDest
|
182
184
|
outputTextKey := datastore.NewKey(c, "Text", outputTextKeyName, 0, nil)
|
183
185
|
outputText := Text{
|
184
|
-
Content:
|
186
|
+
Content: CICERO_PACKAGE_AND_FUNCTION_NAME(),
|
185
187
|
}
|
186
188
|
datastore.Put(c, outputTextKey, &outputText)
|
187
189
|
|
@@ -205,6 +207,3 @@ func mapToJson(mapToConvert map[string]string) []byte {
|
|
205
207
|
}
|
206
208
|
|
207
209
|
// END CICERO-BOILERPLATE CODE
|
208
|
-
// BEGIN USER-PROVIDED FUNCTION
|
209
|
-
CICERO_FUNCTION_CONTENTS
|
210
|
-
// END USER-PROVIDED FUNCTION
|
data/templates/main.py
CHANGED
@@ -33,6 +33,7 @@ class Text(db.Model):
|
|
33
33
|
class TaskRoute(webapp.RequestHandler):
|
34
34
|
def get(self):
|
35
35
|
key_name = self.request.get('task_id')
|
36
|
+
logging.debug("looking up task info for task id " + key_name)
|
36
37
|
task_info = TaskInfo.get_by_key_name(key_name)
|
37
38
|
result = {} # TODO - see if we can remove that
|
38
39
|
try:
|
@@ -40,7 +41,9 @@ class TaskRoute(webapp.RequestHandler):
|
|
40
41
|
except AttributeError:
|
41
42
|
result = {'result':'failure', 'state':'not found'}
|
42
43
|
|
43
|
-
|
44
|
+
str_result = json.dumps(result)
|
45
|
+
logging.debug("task info for task id " + key_name + " is " + str_result)
|
46
|
+
self.response.out.write(str_result)
|
44
47
|
|
45
48
|
def put(self):
|
46
49
|
allowed_routes = ['CICERO_FUNCTION_NAME']
|
@@ -61,7 +64,7 @@ class TaskRoute(webapp.RequestHandler):
|
|
61
64
|
logging.debug('starting a request for url ' + url)
|
62
65
|
new_task = taskqueue.add(url=url, params={'data': json.dumps(json_data)})
|
63
66
|
# TODO - adding the task does not imply success - when does it not?
|
64
|
-
result = {'result':'success', 'task_id':new_task.name, 'output':output}
|
67
|
+
result = {'result':'success', 'task_id':new_task.name, 'output':output, 'id':new_task.name}
|
65
68
|
logging.debug('result of job with input data' + str(json_data) + ' was ' + str(result))
|
66
69
|
self.response.out.write(json.dumps(result))
|
67
70
|
else:
|
@@ -116,22 +119,26 @@ class DataRoute(webapp.RequestHandler):
|
|
116
119
|
|
117
120
|
class ComputeWorker(webapp.RequestHandler):
|
118
121
|
def post(self):
|
122
|
+
logging.debug("starting a new task")
|
119
123
|
raw_data = self.request.get('data')
|
120
124
|
json_data = json.loads(raw_data)
|
121
125
|
input_source = str(json_data['input1'])
|
122
126
|
output_dest = str(json_data['output'])
|
127
|
+
task_id = output_dest # TODO(cgb) - find a way to make me the task's id
|
123
128
|
|
124
|
-
|
125
|
-
task_info = TaskInfo(key_name =
|
129
|
+
logging.debug("adding info about new task, with id " + task_id)
|
130
|
+
task_info = TaskInfo(key_name = task_id)
|
126
131
|
task_info.state = "started"
|
127
132
|
task_info.start_time = datetime.datetime.now()
|
128
133
|
task_info.put()
|
129
134
|
|
135
|
+
logging.debug("done adding task info, running task")
|
130
136
|
output_text = Text(key_name = output_dest)
|
131
137
|
output_text.content = str(CICERO_PACKAGE_AND_FUNCTION_NAME())
|
132
138
|
output_text.put()
|
133
139
|
|
134
|
-
|
140
|
+
logging.debug("done running task - updating task metadata")
|
141
|
+
task_info = TaskInfo.get_by_key_name(task_id)
|
135
142
|
task_info.state = "finished"
|
136
143
|
task_info.end_time = datetime.datetime.now()
|
137
144
|
task_info.put()
|
data/test/test_generator.rb
CHANGED
@@ -149,21 +149,6 @@ class TestGenerator < Test::Unit::TestCase
|
|
149
149
|
}
|
150
150
|
end
|
151
151
|
|
152
|
-
def test_get_python_function
|
153
|
-
main_file1 = "test 1"
|
154
|
-
function_name = "print_hello_world"
|
155
|
-
assert_equal(PY_FUNCTION.strip, Generator.get_python_function(main_file1,
|
156
|
-
function_name, file=GetPythonFunctionFakeFile).strip)
|
157
|
-
|
158
|
-
main_file2 = "test 2"
|
159
|
-
assert_equal(TEST_PYTHON_FILE2.strip, Generator.get_python_function(
|
160
|
-
main_file2, function_name, file=GetPythonFunctionFakeFile).strip)
|
161
|
-
|
162
|
-
main_file3 = "test 3"
|
163
|
-
assert_equal(PY_FUNCTION.strip, Generator.get_python_function(main_file3,
|
164
|
-
function_name, file=GetPythonFunctionFakeFile).strip)
|
165
|
-
end
|
166
|
-
|
167
152
|
def test_write_python_app_yaml
|
168
153
|
assert_nothing_raised(SystemExit) {
|
169
154
|
Generator.write_python_app_yaml_file("boo", "/tmp/boo", GeneratorFakeFile)
|
@@ -177,21 +162,6 @@ class TestGenerator < Test::Unit::TestCase
|
|
177
162
|
}
|
178
163
|
end
|
179
164
|
|
180
|
-
def test_get_go_function
|
181
|
-
main_file1 = "test 1"
|
182
|
-
function_name = "PrintHelloWorld"
|
183
|
-
assert_equal(GO_FUNCTION.strip, Generator.get_go_function(main_file1,
|
184
|
-
function_name, file=GetGoFunctionFakeFile).strip)
|
185
|
-
|
186
|
-
main_file2 = "test 2"
|
187
|
-
assert_equal(TEST_GO_FILE2.strip, Generator.get_go_function(main_file2,
|
188
|
-
function_name, file=GetGoFunctionFakeFile).strip)
|
189
|
-
|
190
|
-
main_file3 = "test 3"
|
191
|
-
assert_equal(GO_FUNCTION_3.strip, Generator.get_go_function(main_file3,
|
192
|
-
function_name, file=GetGoFunctionFakeFile).strip)
|
193
|
-
end
|
194
|
-
|
195
165
|
def test_write_go_app_yaml
|
196
166
|
assert_nothing_raised(SystemExit) {
|
197
167
|
Generator.write_go_app_yaml_file("boo", "/tmp/boo", GeneratorFakeFile)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Chris Bunch
|
@@ -15,7 +15,7 @@ autorequire: oration
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-02-02 00:00:00 -08:00
|
19
19
|
default_executable: oration
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|