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

Doc for using raw container in the map task #984

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

pingsutw
Copy link
Member

  • When using rawContainer in the map task, Input will become string representation of a list, so we have to convert it to a list.
  • Users also need to get the array index first to process specific element in the list.

Signed-off-by: Kevin Su <pingsutw@apache.org>
Signed-off-by: Kevin Su <pingsutw@apache.org>
Signed-off-by: Kevin Su <pingsutw@apache.org>
# 2. Get array index (BATCH_JOB_ARRAY_INDEX_VAR_NAME), and use it to get the element in the list.
def main(a: str, output_dir):
# convert a to list
res = eval(a)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is eval(a)? is this a [] literal? could we get an example of it? is there any other way of getting the list object like loading it through json.loads or something?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah maybe we don't use eval in our examples... or at least json.loads

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Use Raw Container in the map task
# Use Raw Container in map tasks

Comment on lines +202 to +204
# 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# 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.
# 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.

# 2. Get array index (BATCH_JOB_ARRAY_INDEX_VAR_NAME), and use it to get the element in the list.
def main(a: str, output_dir):
# convert a to list
res = eval(a)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah maybe we don't use eval in our examples... or at least json.loads

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