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

Add more cases for std stream logging #3347

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions parsl/dataflow/dflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1391,10 +1391,20 @@ def load_checkpoints(self, checkpointDirs: Optional[Sequence[str]]) -> Dict[str,

@staticmethod
def _log_std_streams(task_record: TaskRecord) -> None:
if task_record['app_fu'].stdout is not None:
logger.info("Standard output for task {} available at {}".format(task_record['id'], task_record['app_fu'].stdout))
if task_record['app_fu'].stderr is not None:
logger.info("Standard error for task {} available at {}".format(task_record['id'], task_record['app_fu'].stderr))
tid = task_record['id']

def log_std_stream(name: str, target) -> None:
if target is None:
logger.info(f"{name} for task {tid} will not be redirected.")
elif isinstance(target, str):
logger.info(f"{name} for task {tid} will be redirected to {target}")
elif isinstance(target, tuple) and len(target) == 2:
logger.info(f"{name} for task {tid} will be redirected to {target[0]} with mode {target[1]}")
else:
logger.error(f"{name} for task {tid} has unknown specification: {target!r}")
Comment on lines +1403 to +1404
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is an error, should it also raise an exception? Otherwise, it feels more like a warning, no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's an error. It should be validated elsewhere and this code path should be unreachable (and so do something more like raise an assertion that this path is "impossible".

"should" in the sense of thats how things could be but aren't. If you get this message, there's a problem and your workflow won't run as you expect. But this log statement is not the place to be validating that user input: prior to this, this code would log at info level whatever garbage you had fed in, and it will continue to log that garbage here in this case.


log_std_stream("Standard out", task_record['app_fu'].stdout)
log_std_stream("Standard error", task_record['app_fu'].stderr)


class DataFlowKernelLoader:
Expand Down
Loading