Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CP-2149 Refactor task APIs and CLIs to be more consistent in their usage and the returned result #22

Closed
evanweible-wf opened this issue Aug 18, 2015 · 2 comments

Comments

@evanweible-wf
Copy link
Contributor

Each task should have two static methods:

static Future<TaskResult> run(...);
static Task start(...);

Additionally, each task's done Future should resolve with the TaskResult instance. The CLIs should return this same TaskResult.

Calling .run() is simpler and eventually returns the end result that consumers want. However, calling .start() gives the consumer the opportunity to stream the output to somewhere like stdout for live feedback.

This will allow our integration tests to call into the CLIs directly to programmatically execute the tests instead of spawning new processes to do that. The returned result can then be used easily by the test to verify information about the task without having to parse the stdout output.

@evanweible-wf
Copy link
Contributor Author

Each task API should define a set of exceptions that may be thrown. The CLI should catch these exceptions and display the message (without stack trace) as the failure message.

This provides a clean usage pattern on both fronts - API users can catch a specific exception, and CLI users will see a helpful message without an ugly stacktrace.

@charliekump-wf charliekump-wf changed the title Refactor task APIs and CLIs to be more consistent in their usage and the returned result CP-2149 Refactor task APIs and CLIs to be more consistent in their usage and the returned result Jul 28, 2016
@evanweible-wf
Copy link
Contributor Author

Obviated with v3. Tools will return an integer exit code or throw meaningful exceptions.

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

No branches or pull requests

1 participant