Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting a task on a local module without an explicit version fails #71

Open
cdman opened this issue Aug 2, 2016 · 2 comments
Open

Comments

@cdman
Copy link

cdman commented Aug 2, 2016

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)
@jaybaker
Copy link

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.

@cdman
Copy link
Author

cdman commented Aug 14, 2017

@jaybaker - this issue is most certainly present in the current code:

version = os.environ["CURRENT_VERSION_ID"].split(".")[0]
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 :(

paulbynd added a commit to paulbynd/appengine-pipelines that referenced this issue Aug 31, 2017
This combines a suggestion by @cdman with the existing code for detecting
versions and modules, which should be robust. It's lightly tested in an
App Engine development environment.
mburgs added a commit to hospiq/appengine-pipelines that referenced this issue Apr 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants