Reuse job attributes in Collate.from_pipeline to fix N+1 problem
Currently initializing the CollateJob take 1 list HTTP call to get the list of ProjectPipelineJob and N number calls to fetch the ProjectJob objects. This is very inefficient and slow.
The issue with ProjectPipelineJob is that it is missing the methods
like .trace()
or .artifact()
therefore it cannot be a replacement
for ProjectJob.
Instead copy ProjectPipelineJob attributes to a new instance of ProjectJob which will be initialized without making HTTP request.
According to the OpenAPI schema ProjectJob and ProjectPipelineJob objects have the same schema:
This way the number of required HTTP calls will drastically go down.