-
Notifications
You must be signed in to change notification settings - Fork 221
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
Digdag push validation on the server side. #1026
Digdag push validation on the server side. #1026
Conversation
Hi @hiroyuki-sato, thank you for taking this improvement.
|
5004fb6
to
c25dddc
Compare
@muga Thank you for the advice. I implement it. I'll add integration tests later. validate tasks.
validate schedule.
|
@hiroyuki-sato it's cool. thanks! |
c25dddc
to
3c58472
Compare
@muga. Please take a look when you have time. I created Those comment part doesn't need to this class. I will just remove it. // validate workflow and schedule
// Set<String> required = new HashSet<>();
for (WorkflowTask task : wf.getTasks()) {
// raise an exception if task doesn't valid.
task.getConfig();
// String require = config.getOptional("require>", String.class).orNull();
// if (require != null && required.add(require)) {
// f.ln(" -> %s", require);
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hiroyuki-sato sorry to be late response.
I created ValidateProjectIT.java for testing this PR. Is it better to place those tests in another class?
Good for me to keep this class. Thank you for adding the test.
Those comment part doesn't need to this class. I will just remove it. What do you think?. I'm not sure it possible to validate more.
I believe this is good as first validation. We will be able to refine it later. so, please remove those comment lines.
srm.tryGetScheduler(rev, def); | ||
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To keep the logic of putProject method simple, can you separate your validation logic from this method and copy the logic to another private method that you will create?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separated validation method.
@muga Thank you for the comment. I removed unnecessary comments and moved validation into a separate method. Please take a look when you have time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hiroyuki-sato thank you for improving! Looks good to me. @yoyama what do you think this change??
digdag-server/src/main/java/io/digdag/server/rs/ProjectResource.java
Outdated
Show resolved
Hide resolved
digdag-server/src/main/java/io/digdag/server/rs/ProjectResource.java
Outdated
Show resolved
Hide resolved
digdag-server/src/main/java/io/digdag/server/rs/ProjectResource.java
Outdated
Show resolved
Hide resolved
@hiroyuki-sato I added a few comments. Could you fix them? Then LGTM. |
@yoyama Thank you for the comment. There is still a much-unused import statement. That's why I can't use Optimize imports feature in IntelliJ. 😢 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM
merged.. |
Thank you! |
Hello, @muga , @yoyama
Could you advise me how to implement a validation?
digdag push
requires validation on the server side.It requires two things at least. And this issue will Fix two issues.
I implement the first one. Second schedule validation seems to require
SchedulerManager
class.hiroyuki-sato@5004fb6#diff-84a9dc43263ac1f78fa3b2aca8234f6fR576
I'm not familiar with Google Guice. I'm not sure how to instantiate it. Do you have any idea for that?
This code almost copies of
digdag check
code.https://github.com/treasure-data/digdag/blob/master/digdag-cli/src/main/java/io/digdag/cli/Check.java
Best regards.