Skip to content

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.

pingsutw added 3 commits April 9, 2023 16:54
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
# 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

# :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

Development

Successfully merging this pull request may close these issues.

3 participants