-
Notifications
You must be signed in to change notification settings - Fork 121
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
base: master
Are you sure you want to change the base?
Conversation
pingsutw
commented
Apr 10, 2023
- 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 <[email protected]>
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) |
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.
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?
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.
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 |
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.
# Use Raw Container in the map task | |
# Use Raw Container in map tasks |
# 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. |
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.
# 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) |
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.
yeah maybe we don't use eval
in our examples... or at least json.loads