Skip to content

Let PHLEX_REGISTER_SOURCE plugins see the job's stage #957

Description

@olantwin

Sources registered with PHLEX_REGISTER_SOURCE build their own provider_bundles, and each provider_bundle carries a stage string. The plugin has no way to learn the stage configured for the job. source_graph_proxy is built from graph_registration_bundle::stage, but it only exposes add_source. Also, unlike provide() (registration_api.hpp), the bundles a source returns don't get "CURRENT" replaced with the job's stage.

So in aegir every generator source block repeats the stage from the top-level config:

{
  stage: 'simulation',
  sources: {
    gun: { cpp: 'particle_gun_source', stage: 'simulation', ... },
  },
}

The plugin reads that key, and we reject "CURRENT" because it would end up as a literal stage name. When the two values differ, for example after phlex --stage foo, the generator products are labelled simulation and everything downstream is labelled foo.

Either of these would let us drop the duplicated key:

  1. a stage() accessor on source_graph_proxy, or
  2. replacing "CURRENT" in the stage of the bundles a source returns, the way provide() already does.

#923 fixed the same gap for PHLEX_REGISTER_PROVIDERS providers.

Activity

  1. added
    enhancement
    on Oct 8, 2026
  2. added theissue type on Oct 8, 2026
  3. added this to the Prototype 0.5 milestone on Oct 8, 2026
  4. beojan commented on Oct 26, 2026

    @beojan
    Contributor

    Hi Oliver,

    Would it be possible for you to implement these providers as explicit providers using PHLEX_REGISTER_PROVIDERS?

    Sources generate implicit providers, which are really more suitable for reading in products produced in a previous stage.

  5. olantwin commented on Oct 27, 2026

    @olantwin
    ContributorAuthor

    Yes, that should be possible. I'll give it a try.

    I guess I'm still wrapping my head around when it's best to use providers and when it's best to use sources.

  6. added a commit that references this issue on Nov 11, 2026
  7. added a commit that references this issue on Nov 19, 2026
  8. knoepfel commented on Nov 20, 2026

    @knoepfel
    Member

    Yes, that should be possible. I'll give it a try.

    I guess I'm still wrapping my head around when it's best to use providers and when it's best to use sources.

    @olantwin, just wondering if you can give a progress report on this. Have you found that it would still be helpful to support "CURRENT" for implicit providers created through sources? Or are explicit providers sufficient/natural for your needs?

  9. olantwin commented on Nov 22, 2026

    @olantwin
    ContributorAuthor

    Apologies for forgetting to reply sooner!

    I've implemented @beojan's suggestion in ShipSoft/aegir#177, and it seems that it's explicit providers work for us in for the use case where I occasionally ran into this.

    Maybe there are other use cases where this could be useful, but in this case I think I was confused about when to best use providers and when to best use sources.

    So I think for now this can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions