Ticket #1035 (closed enhancement: suspended)

Opened 9 years ago

Last modified 7 years ago

Add support in Policy files for references to files in other packages

Reported by: bbaker Owned by: RayPlante
Priority: critical Milestone:
Component: pex_policy Keywords:
Cc: RayPlante, rhl, bbaker Blocked By:
Blocking: Project: LSST
Version Number:
How to repeat:

not applicable


A Policy (or Dictionary, which is a specialized Policy) can contain a reference to another Policy:

sample: {
   foo: bar
   baz: 1.3
   child: @subpolicy.paf 

It would be nice if that reference could be to another product [a.k.a. LSST package], perhaps in the form:

    child: @some_product:some_dir/another_policy.paf

Note the ":" separator in the reference, separating the product name from the file path.

Further, when policies are created, they may be loaded from a "repository" (subdirectory) within a product. The user may want to load from a particular repository in the referenced product.

    child: @some_product:some_repository:some_dir/another_policy.paf

Now there are two ":"s. Conceivably, the user may want to instead load from the same repository that the current policy is loaded from, even if the name of that repository is unknown when the policy is written.

    child: @some_product::some_dir/another_policy.paf

The general syntax is:

    child: @[product_name:[repository_name:]]path

Leaving either product_name or repository_name blank -- but retaining the ":" -- will mean to use the same value as the containing Policy.

Change History

comment:1 Changed 9 years ago by DefaultCC Plugin

  • Cc bbaker added

comment:2 Changed 9 years ago by rhl

This looks good. One comment, I'd use | not : as the separator as it allows us to generalise to URLs if we want to at some point (an unintended side effect is to support windows too).

comment:3 Changed 9 years ago by RayPlante

My suggestion is to cast our generalized syntax into the URI/URN syntax (e.g. start it with "urn:"). This would allow the parser to distinguish between package-based locations and a URL.

comment:4 Changed 9 years ago by ktl

I'm not sure what the difference is between a named repository and a simple prefixed subdirectory. Is this solely for support of "same repository"? Do we really need "same repository in a different package"? What about "different repository in the same package", which does not seem to be covered by the syntax above?

comment:5 Changed 9 years ago by bbaker

  • Status changed from new to assigned

comment:6 Changed 9 years ago by bbaker

  • Status changed from assigned to inTicketWork

comment:7 Changed 9 years ago by bbaker

  • Priority changed from normal to critical

comment:8 Changed 9 years ago by bbaker

After reading about URNs and URLs, is this more of a locator or a name? I can see elements of both, but it's more on the side of a name since it doesn't specify a full location, but rather relies on Policy to derive the path. So calling it a URN makes sense.

How about this (derived from a discussion with Ray):

We're specifying three things:

  • Package
    • optional -- if not specified, use current package
  • Repository (path inside the package)
    • optional -- if not specified, use a blank repository
  • Path (inside the package or repository)
    • required

And we're not specifying the package version -- instead, we use whatever version is installed.

For a format, how about:


But we could abbreviate urn:eupspkg: with a second @:


Here are a few examples, all referring to the same file:

@@ap:pipeline/examples:policy/LoadStage.paf           # @@ means "@urn:eupspkg:"
@@ap:pipeline:examples/policy/LoadStage.paf           # different repository semantics
@@ap:pipeline/examples/policy/loadStage.paf           # no repository, just a path

The following would be illegal, since you can omit the repository, but not have a blank one:


But this possibility allows us lexical flexibility to refer to the current repository but a different package if it becomes useful in the future.

Here are some examples that each refer to the same policy file in the current package (assuming that the current package is pex_policy):


comment:9 Changed 9 years ago by bbaker

  • Status changed from inTicketWork to inStandardsReview
  • Owner changed from bbaker to RayPlante

Done. Policy also supports the "urn:eupspkg:..." syntax in its string constructors.

comment:10 Changed 7 years ago by rhl

  • Status changed from inStandardsReview to closed
  • Resolution set to suspended

pex_policy is replaced by pex_config

comment:11 Changed 7 years ago by robyn

  • Milestone DC3b MW DB MWI Improvements deleted

Milestone DC3b MW DB MWI Improvements deleted

Note: See TracTickets for help on using tickets.