appengine-pipelines
appengine-pipelines copied to clipboard
Starting a task on a local module without an explicit version fails
The root cause of this is this GAE dev_server issue: when running a module locally with dev_appserver.py
which doesn't have version:
in app.yaml
, it will have something like "None.175924092260391774
in os.environ['CURRENT_VERSION_ID']
. This results in util._get_task_target()
returning something like "None.modulename"
which then raises a InvalidModuleError
when trying to enqueue the task in _PipelineContext.start
.
One possible solution would be:
- hopefully the GAE dev_server bug gets fixed quickly
- to migrate
util._get_task_target()
over to modules (since it's using undocumented APIs). Something like:
from google.appengine.api import modules
# ...
def _get_task_target():
# ...
module = modules.get_current_module_name()
version = modules.get_current_version_name()
# workaround until https://code.google.com/p/googleappengine/issues/detail?id=13178& gets fixed
if version == "None": version = None
if module == "default":
return version
if version is None:
return module
return "%s.%s" % (version, module)
I am running into this issue with the latest version at pypi even though the app.yaml in the project has a valid version entry. The latest commit/pull fixes the issue. I think this latest version should be available at pypi.
@jaybaker - this issue is most certainly present in the current code: https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/util.py#L64 so I'm unsure why you say that it should work.
Also, which PR are you referring to? I found #78, but that more masks than fixes the issue. Fortunately the underlying issue has now been fixed (https://issuetracker.google.com/issues/35900827 in the new Google issue tracker). So _get_task_target
could be fixed as:
from google.appengine.api import modules
# ...
def _get_task_target():
# ...
module = modules.get_current_module_name()
version = modules.get_current_version_name()
if module == "default":
return version
if version is None:
return module
return "%s.%s" % (version, module)
Unfortunately nobody seems to follow / update this project :(