Doc for using raw container in the map task #984
Open
Conversation
Member
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 <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) |
Contributor
There was a problem hiding this comment.
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?
Contributor
There was a problem hiding this comment.
yeah maybe we don't use eval in our examples... or at least json.loads
cosmicBboy
reviewed
Jun 20, 2023
| # :language: julia | ||
|
|
||
| # %% | ||
| # Use Raw Container in the map task |
Contributor
There was a problem hiding this comment.
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. |
Contributor
There was a problem hiding this comment.
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) |
Contributor
There was a problem hiding this comment.
yeah maybe we don't use eval in our examples... or at least json.loads
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.