Skip to content

Commit

Permalink
Improve message for start trace behavior. (#2455)
Browse files Browse the repository at this point in the history
# Description

Please add an informative description that covers that changes made by
the pull request and link all relevant issues.

![image](https://github.com/microsoft/promptflow/assets/26239730/725c0062-1199-41a7-9f7f-d420e9e95e13)

# All Promptflow Contribution checklist:
- [ ] **The pull request does not introduce [breaking changes].**
- [ ] **CHANGELOG is updated for new features, bug fixes or other
significant changes.**
- [ ] **I have read the [contribution guidelines](../CONTRIBUTING.md).**
- [ ] **Create an issue and link to the pull request to get dedicated
review from promptflow team. Learn more: [suggested
workflow](../CONTRIBUTING.md#suggested-workflow).**

## General Guidelines and Best Practices
- [ ] Title of the pull request is clear and informative.
- [ ] There are a small number of commits, each of which have an
informative message. This means that previously merged commits do not
appear in the history of the PR. For more information on cleaning up the
commits in your PR, [see this
page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md).

### Testing Guidelines
- [ ] Pull request includes test coverage for the included changes.

---------

Co-authored-by: Ying Chen <2601502859@qq.com>
  • Loading branch information
YingChen1996 and Ying Chen authored Mar 26, 2024
1 parent 1a10dcf commit 83ef48b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/promptflow/promptflow/_sdk/_service/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def validate_port(port, force_start):
app.logger.setLevel(logging.DEBUG)
else:
app.logger.setLevel(logging.INFO)
message = f"Start Prompt Flow Service on {port}, version: {get_promptflow_sdk_version()}"
message = f"Start Prompt Flow Service on {port}, version: {get_promptflow_sdk_version()}."
app.logger.info(message)
print(message)
sys.stdout.flush()
Expand Down Expand Up @@ -197,7 +197,7 @@ def validate_port(port, force_start):
subprocess.Popen(cmd, stdout=subprocess.DEVNULL, start_new_session=True)
is_healthy = check_pfs_service_status(port)
if is_healthy:
message = f"Start Prompt Flow Service on {port}, version: {get_promptflow_sdk_version()}"
message = f"Start Prompt Flow Service on port {port}, version: {get_promptflow_sdk_version()}."
print(message)
logger.info(message)
else:
Expand Down
10 changes: 10 additions & 0 deletions src/promptflow/promptflow/_sdk/_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
)
from promptflow._sdk._configuration import Configuration
from promptflow._sdk._constants import (
PF_SERVICE_HOUR_TIMEOUT,
PF_TRACE_CONTEXT,
PF_TRACE_CONTEXT_ATTR,
AzureMLWorkspaceTriad,
Expand Down Expand Up @@ -61,13 +62,22 @@ def _invoke_pf_svc() -> str:
port = get_port_from_config(create_if_not_exists=True)
port = str(port)
cmd_args = ["start", "--port", port]
hint_stop_message = (
f"You can stop the Prompt flow Tracing Server with the following command:'\033[1m pf service stop\033[0m'.\n"
f"Alternatively, if no requests are made within {PF_SERVICE_HOUR_TIMEOUT} "
f"hours, it will automatically stop."
)
if is_port_in_use(int(port)):
if not is_pfs_service_healthy(port):
cmd_args.append("--force")
else:
print("Prompt flow Tracing Server has started...")
print(hint_stop_message)
return port
print("Starting Prompt flow Tracing Server...")
entry(cmd_args)
logger.debug("Prompt flow service is serving on port %s", port)
print(hint_stop_message)
return port


Expand Down

0 comments on commit 83ef48b

Please sign in to comment.