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

docs: amend imports to remove autodoc mocking #18

Closed
tiborsimko opened this issue Feb 1, 2017 · 0 comments · Fixed by #25
Closed

docs: amend imports to remove autodoc mocking #18

tiborsimko opened this issue Feb 1, 2017 · 0 comments · Fixed by #25
Assignees

Comments

@tiborsimko
Copy link
Member

ReadTheDocs does not build the REST API documentation chapter properly:

probably beacuse of:

reading sources... [ 87%] license
reading sources... [100%] restapi

/home/docs/checkouts/readthedocs.org/user_builds/reana-job-controller/checkouts/latest/docs/restapi.rst:7: WARNING: autodoc: failed to import function u'get_jobs' from module u'reana_job_controller.app'; the following exception was raised:
Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/reana-job-controller/envs/latest/local/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 551, in import_object
    __import__(self.modname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/reana-job-controller/envs/latest/local/lib/python2.7/site-packages/reana_job_controller-0.0.1.dev20170123-py2.7.egg/reana_job_controller/app.py", line 32, in <module>
    import k8s
  File "/home/docs/checkouts/readthedocs.org/user_builds/reana-job-controller/envs/latest/local/lib/python2.7/site-packages/reana_job_controller-0.0.1.dev20170123-py2.7.egg/reana_job_controller/k8s.py", line 30, in <module>
    api = pykube.HTTPClient(pykube.KubeConfig.from_service_account())
  File "/home/docs/checkouts/readthedocs.org/user_builds/reana-job-controller/envs/latest/local/lib/python2.7/site-packages/pykube/config.py", line 22, in from_service_account
    with open(os.path.join(path, "token")) as fp:
IOError: [Errno 2] No such file or directory: '/var/run/secrets/kubernetes.io/serviceaccount/token'
/home/docs/checkouts/readthedocs.org/user_builds/reana-job-controller/checkouts/latest/docs/restapi.rst:12: WARNING: autodoc: failed to import function u'create_job' from module u'reana_job_controller.app'; the following exception was raised:
Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/reana-job-controller/envs/latest/local/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 551, in import_object
    __import__(self.modname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/reana-job-controller/envs/latest/local/lib/python2.7/site-packages/reana_job_controller-0.0.1.dev20170123-py2.7.egg/reana_job_controller/app.py", line 32, in <module>
    import k8s
  File "/home/docs/checkouts/readthedocs.org/user_builds/reana-job-controller/envs/latest/local/lib/python2.7/site-packages/reana_job_controller-0.0.1.dev20170123-py2.7.egg/reana_job_controller/k8s.py", line 30, in <module>
    api = pykube.HTTPClient(pykube.KubeConfig.from_service_account())
  File "/home/docs/checkouts/readthedocs.org/user_builds/reana-job-controller/envs/latest/local/lib/python2.7/site-packages/pykube/config.py", line 22, in from_service_account
    with open(os.path.join(path, "token")) as fp:
IOError: [Errno 2] No such file or directory: '/var/run/secrets/kubernetes.io/serviceaccount/token'
/home/docs/checkouts/readthedocs.org/user_builds/reana-job-controller/checkouts/latest/docs/restapi.rst:17: WARNING: autodoc: failed to import function u'get_job' from module u'reana_job_controller.app'; the following exception was raised:
Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/reana-job-controller/envs/latest/local/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 551, in import_object
    __import__(self.modname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/reana-job-controller/envs/latest/local/lib/python2.7/site-packages/reana_job_controller-0.0.1.dev20170123-py2.7.egg/reana_job_controller/app.py", line 32, in <module>
    import k8s
  File "/home/docs/checkouts/readthedocs.org/user_builds/reana-job-controller/envs/latest/local/lib/python2.7/site-packages/reana_job_controller-0.0.1.dev20170123-py2.7.egg/reana_job_controller/k8s.py", line 30, in <module>
    api = pykube.HTTPClient(pykube.KubeConfig.from_service_account())
  File "/home/docs/checkouts/readthedocs.org/user_builds/reana-job-controller/envs/latest/local/lib/python2.7/site-packages/pykube/config.py", line 22, in from_service_account
    with open(os.path.join(path, "token")) as fp:
IOError: [Errno 2] No such file or directory: '/var/run/secrets/kubernetes.io/serviceaccount/token'
looking for now-outdated files... none found

Locally, this works well because of autodoc_mock_imports directive:

$ git grep k8 docs/conf.py
docs/conf.py:autodoc_mock_imports = ['k8s', ]

It'll be good to amend imports in app.py to something like

from .k8s import foo, bar

so that autodoc_mock_imports directive wouldn't be necessary.

@tiborsimko tiborsimko added this to the Initial-Release milestone Feb 1, 2017
@diegodelemos diegodelemos self-assigned this Feb 1, 2017
diegodelemos pushed a commit to diegodelemos/reana-job-controller that referenced this issue Feb 6, 2017
* Adds `config.py` so that pykube configuration is loaded only at
  run time. (addresses reanahub#18)

* Renames `create_job` on `k8s.py` to avoid name clashing inside
  `app.py`.

Signed-off-by: Diego Rodriguez <[email protected]>
diegodelemos pushed a commit to diegodelemos/reana-job-controller that referenced this issue Feb 6, 2017
* Adds `config.py` so that pykube configuration is loaded only at
  run time. (addresses reanahub#18)

* Renames `create_job` on `k8s.py` to avoid name clashing inside
  `app.py`.

Signed-off-by: Diego Rodriguez <[email protected]>
diegodelemos pushed a commit to diegodelemos/reana-job-controller that referenced this issue Feb 6, 2017
* Adds `config.py` so that pykube configuration is loaded only at
  run time. (addresses reanahub#18)

* Renames `create_job` on `k8s.py` to avoid name clashing inside
  `app.py`.

Signed-off-by: Diego Rodriguez <[email protected]>
diegodelemos pushed a commit to diegodelemos/reana-job-controller that referenced this issue Feb 6, 2017
* Adds `config.py` so that pykube configuration is loaded only at
  run time. (closes reanahub#18)

* Renames `create_job` on `k8s.py` to avoid name clashing inside
  `app.py`.

Signed-off-by: Diego Rodriguez <[email protected]>
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

Successfully merging a pull request may close this issue.

2 participants