Skip to content

Commit

Permalink
[pfs] using "pfcli pf" to submit batch run (#1569)
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.

# 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: Clement Wang <47586720+wangchao1230@users.noreply.github.com>
Co-authored-by: Clement Wang <wangchao1230@outlook.com>
  • Loading branch information
3 people authored Dec 21, 2023
1 parent ad17792 commit ecb0bfb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"ROBOCOPY",
"undoc",
"retriable",
"pfcli",
"pfutil",
"mgmt",
"wsid",
Expand Down
3 changes: 3 additions & 0 deletions src/promptflow/promptflow/_sdk/_service/apis/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import json
import sys
import subprocess
import tempfile
from dataclasses import asdict
Expand Down Expand Up @@ -71,6 +72,8 @@ def post(self):
with open(run_file, "w", encoding="utf-8") as f:
yaml.safe_dump(run_dict, f)
cmd = f"pf run create --file {run_file}"
if sys.executable.endswith("pfcli.exe"):
cmd = f"pfcli {cmd}"
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
stdout, _ = process.communicate()
if process.returncode == 0:
Expand Down

0 comments on commit ecb0bfb

Please sign in to comment.