-
Notifications
You must be signed in to change notification settings - Fork 125
Doc for using raw container in the map task #984
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -14,6 +14,7 @@ | |||||||||||||||
Refer to the raw protocol to understand how to leverage this. | ||||||||||||||||
""" | ||||||||||||||||
import logging | ||||||||||||||||
import sys | ||||||||||||||||
|
||||||||||||||||
from flytekit import ContainerTask, kwtypes, task, workflow | ||||||||||||||||
|
||||||||||||||||
|
@@ -193,3 +194,25 @@ def wf(a: float, b: float): | |||||||||||||||
# ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||||||||||||||||
# .. literalinclude:: ../../../../core/containerization/raw-containers-supporting-files/per-language/julia/calculate-ellipse-area.jl | ||||||||||||||||
# :language: julia | ||||||||||||||||
|
||||||||||||||||
# %% | ||||||||||||||||
# Use Raw Container in the map task | ||||||||||||||||
# ================================= | ||||||||||||||||
# | ||||||||||||||||
# To use raw container in the map task, users have to | ||||||||||||||||
# 1. Manually parse the input data. The input is string representation of a list, so we need to convert it to python list. | ||||||||||||||||
# 2. Get array index (BATCH_JOB_ARRAY_INDEX_VAR_NAME), and use it to get the element in the list. | ||||||||||||||||
Comment on lines
+202
to
+204
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
def main(a: str, output_dir): | ||||||||||||||||
# convert a to list | ||||||||||||||||
res = eval(a) | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is eval(a)? is this a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah maybe we don't use |
||||||||||||||||
# get the job index | ||||||||||||||||
index = int(os.environ.get(os.environ.get("BATCH_JOB_ARRAY_INDEX_VAR_NAME"))) | ||||||||||||||||
... | ||||||||||||||||
|
||||||||||||||||
|
||||||||||||||||
if __name__ == "__main__": | ||||||||||||||||
a = sys.argv[1] | ||||||||||||||||
b = sys.argv[2] | ||||||||||||||||
output_dir = sys.argv[3] | ||||||||||||||||
|
||||||||||||||||
main(a, output_dir) |
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.