Skip to content
This repository was archived by the owner on Oct 11, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions python/demo/app.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
application: pipeline-test
version: 1
runtime: python27
threadsafe: true
api_version: 1

handlers:
- url: /_ah/pipeline(/.*)?
script: pipeline/handlers.py
- url: /_pipeline(/.*)?
script: pipeline.handlers._APP

- url: /static
static_dir: static

- url: .*
login: required
script: main.py
script: main.APP
12 changes: 6 additions & 6 deletions python/demo/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def post(self):
'color',
*colors)
job.start()
self.redirect('/_ah/pipeline/status?root=%s' % job.pipeline_id)
self.redirect('/_pipeline/status?root=%s' % job.pipeline_id)


class MainHandler(webapp.RequestHandler):
Expand All @@ -168,13 +168,13 @@ def post(self):
GuestbookPost(color=color.lower()).put()
self.redirect('/')

APP = webapp.WSGIApplication([
(r'/', MainHandler),
(r'/pipeline', StartPipelineHandler),
], debug=True)

def main():
application = webapp.WSGIApplication([
(r'/', MainHandler),
(r'/pipeline', StartPipelineHandler),
], debug=True)
util.run_wsgi_app(application)
util.run_wsgi_app(APP)


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion python/demo/pipeline
2 changes: 1 addition & 1 deletion python/src/pipeline/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ def from_id(cls, pipeline_id, resolve_outputs=True, _pipeline_record=None):
def start(self,
idempotence_key='',
queue_name='default',
base_path='/_ah/pipeline',
base_path='/_pipeline',
return_task=False,
countdown=None,
eta=None):
Expand Down
18 changes: 9 additions & 9 deletions python/test/common_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,23 +244,23 @@ def FakeEmailMessage(*args, **kwargs):
try:
stage1 = common.EmailToContinue(**mail_kwargs)
outputs1 = self.run_pipeline(
stage1, base_path='/_ah/pipeline', _require_slots_filled=False)
stage1, base_path='/_pipeline', _require_slots_filled=False)

stage2 = common.EmailToContinue(**mail_kwargs)
outputs2 = self.run_pipeline(
stage2, base_path='/_ah/pipeline', _require_slots_filled=False)
stage2, base_path='/_pipeline', _require_slots_filled=False)

mail_kwargs = mail_kwargs.copy()
mail_kwargs['approve_html'] = '<h3>Woot approved!</h3>'
mail_kwargs['disapprove_html'] = '<h3>Doh not approved!</h3>'

stage3 = common.EmailToContinue(**mail_kwargs)
outputs3 = self.run_pipeline(
stage3, base_path='/_ah/pipeline', _require_slots_filled=False)
stage3, base_path='/_pipeline', _require_slots_filled=False)

stage4 = common.EmailToContinue(**mail_kwargs)
outputs4 = self.run_pipeline(
stage4, base_path='/_ah/pipeline', _require_slots_filled=False)
stage4, base_path='/_pipeline', _require_slots_filled=False)

mail_kwargs = mail_kwargs.copy()
mail_kwargs['random_token'] = 'banana'
Expand All @@ -269,7 +269,7 @@ def FakeEmailMessage(*args, **kwargs):
outputs5 = self.run_pipeline(
stage5,
idempotence_key='knownid',
base_path='/_ah/pipeline',
base_path='/_pipeline',
_require_slots_filled=False)
finally:
common.EmailToContinue._email_message = old_email_message
Expand Down Expand Up @@ -306,16 +306,16 @@ def FakeEmailMessage(*args, **kwargs):
message5 = saved[4]

self.assertEquals(
'/_ah/pipeline/callback?choice=approve&pipeline_id=knownid&'
'/_pipeline/callback?choice=approve&pipeline_id=knownid&'
'random_token=banana\n'
'/_ah/pipeline/callback?choice=disapprove&'
'/_pipeline/callback?choice=disapprove&'
'pipeline_id=knownid&random_token=banana',
message5.body)

self.assertEquals(
'<a href="/_ah/pipeline/callback?choice=approve&amp;'
'<a href="/_pipeline/callback?choice=approve&amp;'
'pipeline_id=knownid&amp;random_token=banana">approve</a>\n'
'<a href="/_ah/pipeline/callback?choice=disapprove&amp;'
'<a href="/_pipeline/callback?choice=disapprove&amp;'
'pipeline_id=knownid&amp;random_token=banana">disapprove</a>',
message5.html)

Expand Down
46 changes: 23 additions & 23 deletions python/test/pipeline_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def testStart(self):

self.assertTrue(stage.start() is None)
self.assertEquals('default', stage.queue_name)
self.assertEquals('/_ah/pipeline', stage.base_path)
self.assertEquals('/_pipeline', stage.base_path)
self.assertEquals(stage.pipeline_id, stage.root_pipeline_id)
self.assertTrue(stage.is_root)

Expand All @@ -391,7 +391,7 @@ def testStart(self):
'three': {'type': 'value', 'value': 'red'}})
self.assertEquals([], params['after_all'])
self.assertEquals('default', params['queue_name'])
self.assertEquals('/_ah/pipeline', params['base_path'])
self.assertEquals('/_pipeline', params['base_path'])
self.assertEquals(set(NothingPipeline.output_names + ['default']),
set(params['output_slots'].keys()))
self.assertTrue(pipeline_record.is_root_pipeline)
Expand Down Expand Up @@ -424,7 +424,7 @@ def testStart(self):
{'pipeline_key': [str(db.Key.from_path(
_PipelineRecord.kind(), stage.pipeline_id))]},
task['params'])
self.assertEquals('/_ah/pipeline/run', task['url'])
self.assertEquals('/_pipeline/run', task['url'])

def testStartIdempotenceKey(self):
"""Tests starting a pipeline with an idempotence key."""
Expand All @@ -437,7 +437,7 @@ def testStartReturnTask(self):
stage = NothingPipeline('one', 'two', three='red', four=1234)
task = stage.start(return_task=True, idempotence_key='banana')
self.assertEquals(0, len(test_shared.get_tasks()))
self.assertEquals('/_ah/pipeline/run', task.url)
self.assertEquals('/_pipeline/run', task.url)
self.assertEquals(
'pipeline_key=%s' % db.Key.from_path(_PipelineRecord.kind(), 'banana'),
task.payload)
Expand Down Expand Up @@ -676,7 +676,7 @@ def testGetCallbackUrl(self):
stage.start(idempotence_key='banana')
result = stage.get_callback_url(one='red', two='blue', three=12345)
self.assertEquals(
'/_ah/pipeline/callback'
'/_pipeline/callback'
'?one=red&pipeline_id=banana&three=12345&two=blue',
result)

Expand All @@ -690,7 +690,7 @@ def testGetCallbackTask(self):
method='overridden',
name='my-name',
eta=now)
self.assertEquals('/_ah/pipeline/callback', task.url)
self.assertEquals('/_pipeline/callback', task.url)
self.assertEquals(
{'two': ['blue'],
'one': ['red'],
Expand Down Expand Up @@ -841,13 +841,13 @@ def fake_mail(self, sender, subject, body, html=None):
subject)
self.assertEquals(
'View the pipeline results here:\n\n'
'http://my-app-id.appspot.com/_ah/pipeline/status?root=banana\n\n'
'http://my-app-id.appspot.com/_pipeline/status?root=banana\n\n'
'Thanks,\n\nThe Pipeline API\n',
body)
self.assertEquals(
'<html><body>\n<p>View the pipeline results here:</p>\n\n<p><a href="'
'http://my-app-id.appspot.com/_ah/pipeline/status?root=banana"\n'
'>http://my-app-id.appspot.com/_ah/pipeline/status?root=banana'
'http://my-app-id.appspot.com/_pipeline/status?root=banana"\n'
'>http://my-app-id.appspot.com/_pipeline/status?root=banana'
'</a></p>\n\n<p>\nThanks,\n<br>\nThe Pipeline API\n</p>\n'
'</body></html>\n',
html)
Expand Down Expand Up @@ -879,13 +879,13 @@ def fake_mail(self, sender, subject, body, html=None):
subject)
self.assertEquals(
'View the pipeline results here:\n\n'
'http://my-app-id.appspot.com/_ah/pipeline/status?root=banana\n\n'
'http://my-app-id.appspot.com/_pipeline/status?root=banana\n\n'
'Thanks,\n\nThe Pipeline API\n',
body)
self.assertEquals(
'<html><body>\n<p>View the pipeline results here:</p>\n\n<p><a href="'
'http://my-app-id.appspot.com/_ah/pipeline/status?root=banana"\n'
'>http://my-app-id.appspot.com/_ah/pipeline/status?root=banana'
'http://my-app-id.appspot.com/_pipeline/status?root=banana"\n'
'>http://my-app-id.appspot.com/_pipeline/status?root=banana'
'</a></p>\n\n<p>\nThanks,\n<br>\nThe Pipeline API\n</p>\n'
'</body></html>\n',
html)
Expand Down Expand Up @@ -970,9 +970,9 @@ def testCleanup(self):
task_list = test_shared.get_tasks('default')
self.assertEquals(2, len(task_list))
start_task, cleanup_task = task_list
self.assertEquals('/_ah/pipeline/run', start_task['url'])
self.assertEquals('/_pipeline/run', start_task['url'])

self.assertEquals('/_ah/pipeline/cleanup', cleanup_task['url'])
self.assertEquals('/_pipeline/cleanup', cleanup_task['url'])
self.assertEquals(
'aglteS1hcHAtaWRyHwsSE19BRV9QaXBlbGluZV9SZWNvcmQiBmJhbmFuYQw',
dict(cleanup_task['headers'])['X-Ae-Pipeline-Key'])
Expand All @@ -997,7 +997,7 @@ def testInheritTarget(self):
task_list = test_shared.get_tasks('default')
self.assertEquals(1, len(task_list))
start_task = task_list[0]
self.assertEquals('/_ah/pipeline/run', start_task['url'])
self.assertEquals('/_pipeline/run', start_task['url'])
self.assertEquals(
'my-version.foo-module.my-app-id.appspot.com',
dict(start_task['headers'])['Host'])
Expand All @@ -1011,7 +1011,7 @@ def testWithParams(self):
task_list = test_shared.get_tasks('default')
self.assertEquals(1, len(task_list))
start_task = task_list[0]
self.assertEquals('/_ah/pipeline/run', start_task['url'])
self.assertEquals('/_pipeline/run', start_task['url'])
self.assertEquals(
'my-cool-target.my-app-id.appspot.com',
dict(start_task['headers'])['Host'])
Expand Down Expand Up @@ -1155,13 +1155,13 @@ def fake_mail(self, sender, subject, body, html=None):
subject)
self.assertEquals(
'View the pipeline results here:\n\n'
'http://my-hrd-app.appspot.com/_ah/pipeline/status?root=banana\n\n'
'http://my-hrd-app.appspot.com/_pipeline/status?root=banana\n\n'
'Thanks,\n\nThe Pipeline API\n',
body)
self.assertEquals(
'<html><body>\n<p>View the pipeline results here:</p>\n\n<p><a href="'
'http://my-hrd-app.appspot.com/_ah/pipeline/status?root=banana"\n'
'>http://my-hrd-app.appspot.com/_ah/pipeline/status?root=banana'
'http://my-hrd-app.appspot.com/_pipeline/status?root=banana"\n'
'>http://my-hrd-app.appspot.com/_pipeline/status?root=banana'
'</a></p>\n\n<p>\nThanks,\n<br>\nThe Pipeline API\n</p>\n'
'</body></html>\n',
html)
Expand Down Expand Up @@ -3314,7 +3314,7 @@ def testSuccess(self):
# The order of the tasks (start or cleanup) is unclear, so
# fish out the one that's the cleanup task and run it directly.
for task in task_list:
if task['url'] == '/_ah/pipeline/cleanup':
if task['url'] == '/_pipeline/cleanup':
self.run_task(task)

self.assertEquals(0, len(list(_PipelineRecord.all())))
Expand All @@ -3338,7 +3338,7 @@ def testOldStyle(self):
task_list = self.get_tasks()
self.assertEquals(1, len(task_list))
fanout_task = task_list[0]
self.assertEquals('/_ah/pipeline/fanout', fanout_task['url'])
self.assertEquals('/_pipeline/fanout', fanout_task['url'])

after_record = db.get(stage._pipeline_key)

Expand All @@ -3353,7 +3353,7 @@ def testOldStyle(self):

self.assertEquals(2, len(task_list))
for task in task_list:
self.assertEquals('/_ah/pipeline/run', task['url'])
self.assertEquals('/_pipeline/run', task['url'])
children_keys = [
db.Key(t['params']['pipeline_key'][0]) for t in task_list]

Expand Down Expand Up @@ -5082,7 +5082,7 @@ def testGetRootListClassPath(self):
self.assertEquals(['__main__.EchoSync'],
[p['classPath'] for p in found['pipelines']])



if __name__ == '__main__':
logging.getLogger().setLevel(logging.DEBUG)
Expand Down