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

job.get_build() may throw an exception #107

Open
dd-dino opened this issue Nov 21, 2024 · 2 comments
Open

job.get_build() may throw an exception #107

dd-dino opened this issue Nov 21, 2024 · 2 comments

Comments

@dd-dino
Copy link

dd-dino commented Nov 21, 2024

I have code that looks like this:

job = japi.build_job(job_name, **params)
while not job.get_build(): # this line throws exception
    time.sleep(1)
build = job.get_build()

and it occasionally throws an exception like this:
Traceback (most recent call last): . . . in run_job while not job.get_build(): File "/opt/scotty/bazel_install/execroot/__main__/bazel-out/k8-fastbuild/bin/middleware_v2/jenkins/replay_trend_branches.runfiles/dd_py_deps_api4jenkins/site-packages/api4jenkins/queue.py", line 55, in get_build self._build = self._new_item( File "/opt/scotty/bazel_install/execroot/__main__/bazel-out/k8-fastbuild/bin/middleware_v2/jenkins/replay_trend_branches.runfiles/dd_py_deps_api4jenkins/site-packages/api4jenkins/item.py", line 67, in _new_item return new_item(self.jenkins, module, item) File "/opt/scotty/bazel_install/execroot/__main__/bazel-out/k8-fastbuild/bin/middleware_v2/jenkins/replay_trend_branches.runfiles/dd_py_deps_api4jenkins/site-packages/api4jenkins/item.py", line 38, in func class_name = delimiter.split(item['_class'])[-1] TypeError: 'NoneType' object is not subscriptable

@joelee2012
Copy link
Owner

@dd-dino it seems the queue item does not include executable object, is there any zombie queue item ?

@dd-dino
Copy link
Author

dd-dino commented Dec 2, 2024

There is nothing wrong on the Jenkins server side. Perhaps the client is making some assumptions that may not always hold.
I have worked around this issue by wrapping the job.get_build() call in a try / except block in a separate function.

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