8000 changes StreamablePopen to return a process and implement listening by JamesKunstle · Pull Request #229 · instructlab/training · GitHub
[go: up one dir, main page]

Skip to content

changes StreamablePopen to return a process and implement listening - #229

Merged
mergify[bot] merged 1 commit into
instructlab:mainfrom
JamesKunstle:fix-interruptable-subprocess
Sep 26, 2024
Merged

mergify[bot] merged 1 commit into
instructlab:mainfrom
JamesKunstle:fix-interruptable-subprocess

Conversation

@JamesKunstle
Copy link
Copy Markdown
Contributor

The original logic wasn't working because StreamablePopen started a process and then listened on the output file instead of returning a process that could be terminated/killed.

This adds 'process.listen' to implement the same behavior as before, but only after the StreamablePopen object has returned a reference to itself. When a KeyboardInterrupt is sent, the process can be terminated and/or killed, and the Exception/Interrupt can be raised.

@RobotSail RobotSail left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@mergify mergify Bot added the one-approval label Sep 26, 2024
Comment thread src/instructlab/training/main_ds.py Outdated
from copy import deepcopy
from pathlib import Path
import argparse
import logging
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Have you tested that this logging works? If I remember correctly, you need to initialize the logger first before it prints anything. Otherwise calling logging.xxx doesn't do anything.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

setup logger

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice, thank you!

@Maxusmusti Maxusmusti left a comment
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fix @RobotSail suggestion

@JamesKunstle
JamesKunstle force-pushed the fix-interruptable-subprocess branch 2 times, most recently from 2d24510 to a081ce0 Compare September 26, 2024 19:12
@mergify mergify Bot added ci-failure and removed ci-failure labels Sep 26, 2024
@JamesKunstle
JamesKunstle force-pushed the fix-interruptable-subprocess branch from a081ce0 to ef7e22a Compare September 26, 2024 19:30
@mergify mergify Bot removed the ci-failure label Sep 26, 2024
@JamesKunstle
JamesKunstle force-pushed the fix-interruptable-subprocess branch from ef7e22a to 8136e13 Compare September 26, 2024 19:53
this corrects behavior: now, ctl-c (sigint) will be correctly handled by the subprocess handler.

Signed-off-by: James Kunstle <jkunstle@redhat.com>
@JamesKunstle
JamesKunstle force-pushed the fix-interruptable-subprocess branch from 8136e13 to 5d1aee3 Compare September 26, 2024 19:54
@JamesKunstle
Copy link
Copy Markdown
Contributor Author

@Maxusmusti @RobotSail removed logging, back to printing.

@RobotSail
Copy link
Copy Markdown
Member

Thanks! LGTM

@Maxusmusti Maxusmusti left a comment
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

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

0