I am a bit confused about Resources. I vaguely und...
# dagster-feedback
I am a bit confused about Resources. I vaguely understand the resources aspect, of being able to override different resources per environments, but I have not been able to fully grasp how resource can be used to execute cli commands ? If I have to run cli commands and extract its output, what’s best way to achieve it in Dagster? Are there any examples / samples that demostrate its advantage over calling subprocess ?
Hey Binoy - I think calling subprocess is a good option. Is there somewhere in our docs where you read that resources are preferred?
Copy code
So, why use resources?

    Plug in different implementations in different environments - If you have a heavy external dependency that you want to use in production, but avoid using in testing, you can accomplish this by providing different resources in each environment. Check out Separating Business Logic from Environments for more info about this capability.
    Share configuration across multiple ops or assets - Resources are configurable and shared, so you can supply configuration in one place instead of configuring the ops and assets individually.
    Share implementations across multiple ops or assets - When multiple ops access the same external services, resources provide a standard way to structure your code to share the implementations.
I might be leaning on to this portion ☝️ . It does not explicitly say it but I am not clear enough as to why a construct like
was created. Utilizing resources would allow a user to share it without direct reference injection, but why even have it, external service can be used by multiple callers just by creating a singleton object and passing its reference
I am still on the “quest” to put in a meltano implementation. Meltano is best suited as CLI because the library does not have any Public APIs for consumption. I want to build a “Builder” wrapper around CLI execution, but here too.. I am not clear enough as to Should I wrap the CLI calls within
or just a direct call to
new to dagster here as well myself in your shoes i would use @resource to configure any auth params and general cli switches for a Meltano class, especially if they differ across a sandbox or prod account. the @op would declare it needs the meltano resource, which dagster injects for you into the op using the relevant config. then the op would invoke a specific cli command, and return any output as an Out for the @op