fix: always extract the last line of the sandbox output as the metric#89
fix: always extract the last line of the sandbox output as the metric#89hiverge-robot merged 4 commits intohiverge:mainfrom
Conversation
Signed-off-by: kerthcet <kerthcet@gmail.com>
Signed-off-by: kerthcet <kerthcet@gmail.com>
| "Run command failed: %s.", e | ||
| ) | ||
| try: | ||
| # If the script leaves checkpointed json data, find and return it |
There was a problem hiding this comment.
I didn't find any code related to the checkpoint in sandbox, we have the mechanism in coordinator, not in sandbox I think.
| if process.returncode != 0: | ||
| raise FunctionExecutionError(f"Error: {stderr}") | ||
| return stdout | ||
| return stdout.strip().splitlines()[-1] # Return only the last line of output |
There was a problem hiding this comment.
Always take the last line of the output as metrics as one solution as we discussed last Friday, WDYT? @brp-hiverge
There was a problem hiding this comment.
Is it always going to be only one line?
There was a problem hiding this comment.
From my experience, we always use the last line of the output. And for json.dumps(), it's always one line.
There was a problem hiding this comment.
I see that json.dumps() indeed returns one line, but what if we have a field in the json that contains a multiline content (e.g. feedback)?
There was a problem hiding this comment.
Actually the newline is escaped as \n, rather than an actual line break. So what you propose makes a lot of sense.
There was a problem hiding this comment.
The \n in json.dumps() will not lead to a new line.
Signed-off-by: kerthcet <kerthcet@gmail.com>
|
ping @brp-hiverge |
This reverts commit c778bcd.
|
PTAL @brp-hiverge |
|
/lgtm |
|
/kind bug |
No description provided.