Best practices for shared/external subgraphs across sandboxes?

I’m putting together a simple utility subgraph that will be used by jobflows/graphs in multiple sandboxes on our server, accessing files from within those sandboxes. (It’s a tool for uploading to our secure document store, which several distinct projects will use.) What’s the least-redundant way to set this up? As far as I can tell, my options are:

  1. Put the subgraph in its own sandbox, and have the jobflows/graphs run it using a path to that external sandbox (e.g. “sandbox://${SANDBOX_NAME}/graph/subgraph/subgraph_name.sgrf”. In this case, I’d have to figure out how to pass fully resolved file paths into the subgraph, since normal relative paths (e.g. “${PROJECT}/foo”) would differ between the source sandbox and the sandbox that’s running the shared subgraph.

  2. Put redundant copies of the subgraph and its associated files (a custom Java transformation and some .jars) in each sandbox that will use it. This would eliminate pathing issues, and I think we could reduce the possibility for confusion by keeping it versioned as its own GitHub project and deploying it simultaneously to all sandboxes when updates are made, but still I think it’d be silly-looking.

My preference of course is option 1) but I wonder if there are any gotchas or other quirks I should know about, since it doesn’t seem very commonplace for sandbox assets to interact with external sandboxes. Thanks in advance!

Hi Markus,

I would definitely suggest to use the first approach. This is usually the right way to share a commonly re-usable parts. The situation with ambiguous ${PROJECT} parameter can be quite easily solved by passing the absolute path to the subgraph which can be dynamically generated in the caller graph by a similar code:

$out.0.path = toAbsolutePath(getParamValue("PROJECT"));

or (they are equal)

$out.0.path = toAbsolutePath("${PROJECT}");

This will return the current absolute path of the project, so it have to be called in the parent graph and the resulting value has to be passed to the subgraph.

Hope this helps.

Best regards,