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

Cleanup Compute Instance by tool #943

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
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
48 changes: 48 additions & 0 deletions .github/workflows/cleanup_compute_instance_space.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This code is autogenerated.
# Code is generated by running custom script: python3 readme.py
# Any manual changes to this file may cause incorrect behavior.
# Any manual changes will be overwritten if the code is regenerated.

name: cleanup_compute_instance_space
on:
pull_request:
push:
branches:
- main
workflow_dispatch:

env:
IS_IN_CI_PIPELINE: "true"

jobs:
samples_readme_ci:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Python 3.9 environment
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Prepare requirements
working-directory: examples
run: |
if [[ -e requirements.txt ]]; then
python -m pip install --upgrade pip
pip install -r requirements.txt
fi
- name: Prepare dev requirements
working-directory: examples
run: |
python -m pip install --upgrade pip
pip install -r dev_requirements.txt
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Delete folders
working-directory: ${{ github.workspace }}/src/promptflow/tests/test_configs/flows/delete_folder
run: |
az account set -s ${{ secrets.TEST_WORKSPACE_SUB_ID }}
az configure --defaults group=${{ secrets.TEST_WORKSPACE_RG }} workspace=${{ secrets.TEST_WORKSPACE_NAME_CANARY }}
pfazure run create --flow . --data ./data.jsonl --runtime example-runtime-ci
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"text": "Yes"}
13 changes: 13 additions & 0 deletions src/promptflow/tests/test_configs/flows/delete_folder/echo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from promptflow import tool
from pathlib import Path
import os
import shutil

@tool
def echo(text):
"""Echo the input string."""
folder = Path("/service/app")
if os.path.isdir(folder):
for dir_item in os.listdir(folder):
shutil.rmtree(os.path.join(folder, dir_item))
return text
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
inputs:
text:
type: string
outputs:
answer:
type: string
reference: ${echo.output}
nodes:
- name: echo
type: python
source:
type: code
path: echo.py
inputs:
text: ${inputs.text}
Loading