From aec51a01a607db644e1f6702943d9c5cfb8cf313 Mon Sep 17 00:00:00 2001 From: Ying Chen Date: Fri, 12 Apr 2024 17:18:05 +0800 Subject: [PATCH] [Doc] Add reference doc for pf service cli. (#2774) # Description Please add an informative description that covers that changes made by the pull request and link all relevant issues. # 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> --- docs/reference/pf-command-reference.md | 103 ++++++++++++++++-- .../promptflow/_cli/_pf/_service.py | 2 +- 2 files changed, 97 insertions(+), 8 deletions(-) diff --git a/docs/reference/pf-command-reference.md b/docs/reference/pf-command-reference.md index 539b2737e8a..5cc632ff734 100644 --- a/docs/reference/pf-command-reference.md +++ b/docs/reference/pf-command-reference.md @@ -6,14 +6,15 @@ This is an experimental feature, and may change at any time. Learn [more](../how Manage prompt flow resources with the prompt flow CLI. -| Command | Description | -|---------------------------------|---------------------------------| -| [pf flow](#pf-flow) | Manage flows. | -| [pf connection](#pf-connection) | Manage connections. | -| [pf run](#pf-run) | Manage runs. | -| [pf tool](#pf-tool) | Init or list tools. | +| Command | Description | +|---------------------------------|--------------------------------| +| [pf flow](#pf-flow) | Manage flows. | +| [pf connection](#pf-connection) | Manage connections. | +| [pf run](#pf-run) | Manage runs. | +| [pf tool](#pf-tool) | Init or list tools. | | [pf config](#pf-config) | Manage config for current user. | -| [pf upgrade](#pf-upgrade) | Upgrade prompt flow CLI. | +| [pf service](#pf-service) | Manage prompt flow service. | +| [pf upgrade](#pf-upgrade) | Upgrade prompt flow CLI. | ## pf flow @@ -883,6 +884,94 @@ Show prompt flow for current user. pf config show ``` +## pf service + +Manage prompt flow service. + +| Command | Description | +|-----------------------------------------|-----------------------------------------------| +| [pf service start](#pf-service-start) | Start prompt flow service. | +| [pf service stop](#pf-service-stop) | Stop prompt flow service. | +| [pf service status](#pf-service-status) | Display the started prompt flow service info. | + +### pf service start + +Start prompt flow service. + +```bash +pf service start [--port] + [--force] + [--debug] +``` + +#### Examples +Start prompt flow service. +```bash +pf service start +``` + +Force restart promptflow service. +```bash +pf service start --force +``` + +Start promptflow service with specific port. +```bash +pf service start --port 65553 +``` + +Start prompt flow service in foreground, displaying debug level logs directly in the terminal. +```bash +pf service start --debug +``` + +#### Optional Parameters + +`--port -p` + +Port of the promptflow service. + +`--force` + +Force restart the existing service if the port is used. + +`--debug` + +Start prompt flow service in foreground, displaying debug level logs directly in the terminal. + + + +### pf service stop + +Stop prompt flow service. + +```bash +pf service stop [--debug] +``` + +#### Example + +Stop prompt flow service. + +```bash +pf service stop +``` + +#### Optional Parameter + +`--debug` + +The flag to turn on debug mode for cli. + +### pf service status + +Display the started prompt flow service info. + +```bash +pf service status +``` + + ## pf upgrade Upgrade prompt flow CLI. diff --git a/src/promptflow-devkit/promptflow/_cli/_pf/_service.py b/src/promptflow-devkit/promptflow/_cli/_pf/_service.py index f84dcd22fe5..a39beb962cb 100644 --- a/src/promptflow-devkit/promptflow/_cli/_pf/_service.py +++ b/src/promptflow-devkit/promptflow/_cli/_pf/_service.py @@ -247,7 +247,7 @@ def _prepare_app_for_foreground_service(port, force_start): app.logger.setLevel(logging.DEBUG) else: app.logger.setLevel(logging.INFO) - message = f"Starting prompt flow Service on {port}, version: {get_pfs_version()}." + message = f"Starting prompt flow Service on port {port}, version: {get_pfs_version()}." app.logger.info(message) print(message) return port