#3930 koji API returns nothing from listTaskOutput() for older builds
Closed: Fixed by tkopecek. Opened by zbyszek.

(For context, I'm working on the stuff as in https://pagure.io/koji/issue/3878…)

It seems that listTaskOutputs() doesn't return anything for builds older than ~2 weeks:

$ python empty_listTaskOutput.py rust-semver-1.0.20-1.fc38
task['method']='buildArch' task['arch']='s390x' task['id']=107307597
output: ['state.log', 'build.log', 'root.log', 'mock_output.log', 'hw_info.log', 'rust-semver+default-devel-1.0.20-1.fc38.noarch.rpm', 'rust-semver-devel-1.0.20-1.fc38.noarch.rpm', 'rust-semver+serde-devel-1.0.20-1.fc38.noarch.rpm', 'rust-semver+std-devel-1.0.20-1.fc38.noarch.rpm', 'noarch_rpmdiff.json']
…
$ python empty_listTaskOutput.py snapshot-45.0-4.fc39                      
task['method']='tagBuild' task['arch']='noarch' task['id']=107135952
output: []
task['method']='buildArch' task['arch']='aarch64' task['id']=107135367
output: []
task['method']='buildArch' task['arch']='s390x' task['id']=107135369
output: []
task['method']='buildSRPMFromSCM' task['arch']='noarch' task['id']=107135269
output: []
task['method']='buildArch' task['arch']='ppc64le' task['id']=107135368
output: []
task['method']='buildArch' task['arch']='x86_64' task['id']=107135366
output: []

This is confusing, because through the web interface, various outputs are listed: https://koji.fedoraproject.org/koji/buildinfo?buildID=2302556

I assume that the issue is based on the age of build, because I get empty results for all older builds and non-empty for recent builds, but I didn't do any comprehensive testing.


empty_listTaskOutput.py:

import koji
import sys
KOJI = koji.get_profile_module('koji')
session_opts = KOJI.grab_session_options(KOJI.config)
SESSION = KOJI.ClientSession(KOJI.config.server, session_opts)
for arg in sys.argv[1:]:
    build = SESSION.getBuild(arg, strict=True)
    tasks = SESSION.getTaskChildren(build['task_id'])
    for task in tasks:
        print(f"{task['method']=} {task['arch']=} {task['id']=}")
        print('output:', SESSION.listTaskOutput(task['id']))

Yes, task output is garbage-collected after certain time. It can't be relied on forever. Treat it as "working content" useful for debugging the build for some time after it is built or failed. What is stored in build (not a task) is important and will be there until build itself will not get garbage-collected. Those can be acquired via getBuildLogs, listBuildRPMs, listArchives and similar.

Metadata Update from @tkopecek:
- Custom field Size adjusted to None

Metadata Update from @tkopecek:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

This issue has been migrated to Fedora Forge:
https://forge.fedoraproject.org/koji/koji/issues/3930

Please continue any further discussion there.

Metadata