Meltano Plugin SDK: First iteration contract and spec proposal #9
Replies: 4 comments 13 replies
-
Few quick initial questions/thoughts about your first pass @aaronsteers: Command Name Contracts
I can see people just creating basic wrappers for existing CLI's and commands that forward commands/args - and doing pattern matched invocations could be a really nice shortcut there, but could also lead to unexpected invocation. I'm a little torn, I was going to suggest that to start with, it might be worth only inferring what to do or invoke via explicit means and then supporting pattern-matched by convention behavior for later. But, on the other hand, having pattern-matched invocations out of the gate early on prevents unexpected behavior changes in a later version - so probably is good to have this sooner rather than later. Capability-to-Command Declarations
Small pet-peeve, whatever we call this command flag - could we call it something other than
@aaronsteers can you say more on this? Do you just mean because we'll have a yaml config describing the capabilities? Thinking out loud: Wonder if this would evolve overtime. As this framework gets more prevalent, would we want to become better at dynamically detecting a plugins capabilities and supported behaviors? Not sure, if it's even that useful beyond saving some keystrokes at config time. Setup and Cleanup Hooks
Just want to clarify and be explicit. When you say "by commands" do you mean commands like the actual cli command's like "airflow" and "dbt" or sub-commands like "airflow scheduler" and "dbt run"? Or both, I suppose.
With a contributor hat of "im just quickly trying to get some 3rd party command into the meltano ecosystem" on, the "via a simple scan of command names in yaml" approach sounds really nice, quick, and easy because I'm probably already very comfortable using yaml to drive work. If I'm the maintainer of a complex plugin though, being able to drive that from capabilities might be nice - but not having this ability probably wouldn't be a deal breaker since I can instruct users how to drive this from the yaml config. Compatibility with Docker-based plugins
Generally true, with the caveat that there's almost certainly going to be gotchas and issues for plugins that themselves's expect to leverage docker. Accidental Docker-In-Docker or Container-In-Container style scenarios. Which actually makes me wonder if plugins should advertise how they'll be executing things or perhaps advertise how they're allowed to be called: e.g. allowed_execution_modes: ["native", "docker", "oci"] VersioningWe should bake this in now, I'm willing to bet that we'll want some way to signal versioning of the spec a plugin supports sooner rather than later. |
Beta Was this translation helpful? Give feedback.
-
@aaronsteers @edgarrmondragon @pnadolny13 curious what sort of hooks do you think we'll need? Do we need to essentially copy meltano's internal hook's? That feels like too big an interface surface. Is a basic set of pre/post hooks like @pnadolny13 did during his hack-sploration sufficient? That meshes nice with the block pattern, which currently also just uses a basic set of pre/post hooks. If the basic pre/post pattern is sufficient to start with, are there any special hooks we should consider supporting out the gate. Like a post_install hook to call at install time? |
Beta Was this translation helpful? Give feedback.
-
@aaronsteers closing in on a draft spec (with some working examples). My last big missing piece is how or if we want to implement passing context to plugins in the first version. This is purely passing a read-only context from meltano to the plugin, its not bidirectional or anything. In my current version, I'm passing a very basic context around that looks essentially like this for a simple "invocation_id": "eca7bf08-845f-40e0-aa2c-317dd8de1fc8" # used by the plugins to find themself in the invocation context
"meltano_invocation_context": [{
"id": "eca7bf08-845f-40e0-aa2c-317dd8de1fc8"
"plugin_name": "meltano-echo",
"command": "test"
"args": [],
"last_hook_called": "pre-invoke",
"meltano_cli_path": ".meltano/run/bin",
"workdir": ".",
"status": "inflight"
}] # array describing what in the execution chain As part of a So two explicit questions.
|
Beta Was this translation helpful? Give feedback.
-
headsup - I transferred this discussion to the EDK repo. @aaronsteers now that edk has landed - I need to update the spec, I can do it as another comment like we have in this discussion in the past but was thinking it might be nice to write up the current spec and implementer expectations and check them into the EDK repo as a living SPECIFICATION.md file alongside the README.md, wdyt? |
Beta Was this translation helpful? Give feedback.
-
Status: Stub, WIP Draft, Reviews and Alternatives much appreciated.
Spec Proposal Overview
Each plugin may have one or more declared capabilities and commands which correspond to specific behaviors and expectations when invoked by Meltano.
Command Name Contracts
Command names may be exactly named by convention (in the case of
start
andstop
) or they can be pattern-matched by convention (test
,test-foo
, andtest_bar
all match tomeltano test
). When a command name matches to a known behavior, Meltano may "smartly" invoke the specified command when the behavior is implemented.Capability-to-Command Declarations
In the plugin definition yaml (and/or in
--about
command output), the plugins can advertise which contract(s) they subscribe to.Note: Since commands are statically detectable, we may not need to rely much on capabilities.
Setup and Cleanup Hooks
Setup and Cleanup Hooks would be defined by commands, for instance
setup_hook
andcleanup_hook
for example. Meltano could either detect these via a simple scan of command names in yaml, or else they could be 'advertised' by specific capabilities that the plugin would advertise.Templates and SDKs
Compatibility with Docker-based plugins
Because this approach is command-driven, the spec itself is 100% compatible with container-based plugins.
Beta Was this translation helpful? Give feedback.
All reactions