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

Add example code for Java and Scala in the "Meet Flyte" page #1183

Merged
merged 4 commits into from
Jul 8, 2021

Conversation

mayitbeegh
Copy link
Contributor

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:
image
With comments:
image
The comments do make the supposedly introductory examples appear more intimidating.

Signed-off-by: Sean Lin <sean@union.ai>
@welcome
Copy link

welcome bot commented Jun 28, 2021

Thank you for opening this pull request! 🙌
These tips will help get your PR across the finish line: - Most of the repos have a PR template; if not, fill it out to the best of your knowledge. - Sign off your commits (Reference: DCO Guide).

// uses the task output of the AddQuestionTask as the output of the workflow
builder.output("greeting", greetingWithQuestion, "Welcome message")
}
}
Copy link
Contributor

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?"

Copy link
Contributor Author

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

Copy link
Contributor Author

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
Copy link
Contributor

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 😬 ?

Copy link
Contributor

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

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@EngHabu
Copy link
Contributor

EngHabu commented Jun 28, 2021

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>
@mayitbeegh mayitbeegh marked this pull request as ready for review July 7, 2021 00:34
@mayitbeegh mayitbeegh merged commit 0d286a1 into master Jul 8, 2021
@welcome
Copy link

welcome bot commented Jul 8, 2021

Congrats on merging your first pull request! 🎉

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

Successfully merging this pull request may close these issues.

None yet

3 participants