Project

Profile

Help

Story #4294

closed

Stages API allows content "discovered" with content downloaded using ArtifactDownloader stage cannot be artibraritly deep

Added by bmbouter over 5 years ago. Updated over 4 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 48
Quarter:

Description

The Problem

Consider Docker which uses the ArtifactDownloader + ArtifactSaver to download a metadata file and save it. That metadata file identifies N more downloads, and those downloads identify more things, and so one forming an arbitrarily large tree data structure. For terminology purposes, call each level of these a "layer" of discovery.

Currently the only way to have the ArtifactDownloader + ArtifactSaver stages download objects in subsequent "layers" is to make the pipeline longer and have more instances of the ArtifactDownloader + ArtifactSaver. This solution won't work in cases where the number of layers is not known and can't be known before runtime. This is the case with Maven for example.

The Solution

1. Extend DeclarativeContent to allow for a asyncio.Future to be attached. This future can be known about in FirstStage when it creates the the DeclarativeContent. Having the reference to the Future from FirstStage allows the plugin writer to await on it for a result.

2. Create a new stage in the pipeline called ResolveContentFutures that will set the result of the DeclarativeContent.future to the DeclarativeContent.content

3. When FirstStage awaits on DeclarativeContent.get_future() it will receive the fully downloaded Content Unit which it can then use to generate more DeclarativeContent objects to send down the pipeline.

This solution was originally inspired by an idea from mdellweg and suggested by gmbnomis.

Also available in: Atom PDF