-
Notifications
You must be signed in to change notification settings - Fork 546
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
Add example code for Java and Scala in the "Meet Flyte" page #1183
Conversation
Signed-off-by: Sean Lin <sean@union.ai>
Thank you for opening this pull request! 🙌 |
// uses the task output of the AddQuestionTask as the output of the workflow | ||
builder.output("greeting", greetingWithQuestion, "Welcome message") | ||
} | ||
} |
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.
Is there something similar to calling it like in python? https://github.com/flyteorg/flyte/pull/1183/files#diff-9a1147ef4c0aeaf0680900dbd2902c51d2a5475c0c21a606fbe1c9420c4261edR80-R81
welcome("Traveler")
# Output: "Welcome, Traveler! How are you?"
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.
Yes, like a main() method
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.
Turns out that although it's easy to execute a task by itself, it's not trivial to execute a workflow similar to Python.
def welcome(name: str) -> str: | ||
greeting = greet(name=name) | ||
return add_question(greeting=greeting) | ||
@task |
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.
While we are at it, can we also add comments to python 😬 ?
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.
@EngHabu I am actually thinking of removing comments from Java. To make it more concise, but just use good code. But the actual example should have comments - and we should link to the actual example
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.
Can we simplify the comments to explain "what and why things need to be written the way it's for Flyte" as opposed to adding "java docs" everywhere?
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.
@EngHabu Most javadocs are not related to Flyte concepts, we can remove all javadocs and keep the inline comments in the workflow file.
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.
excellent!
|
||
You can compose one or more tasks to create a ``workflow``: | ||
.. tab:: python |
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.
Is there an obvious link in the page that takes you to the rest of the python examples? if not, let's add one, if yes, then let's add a link to the "java examples page" (if that's a thing) as well...
Or maybe they should be at the end of teach of the tabs?
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.
I don't think there is.
Can we simplify the comments to explain "what and why things need to be written the way it's for Flyte" as opposed to adding "java docs" everywhere? |
Signed-off-by: Sean Lin <sean@union.ai>
Signed-off-by: Sean Lin <sean@union.ai>
Congrats on merging your first pull request! 🎉 |
The Java/Scala examples contain significantly more code than Python. I'm debating on whether I should add all the comments because they're hard to understand without them. Here's a comparison:
Without comments:
With comments:
The comments do make the supposedly introductory examples appear more intimidating.