-
Notifications
You must be signed in to change notification settings - Fork 962
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
Batch run visualization feature does not work in VS Code #3857
Comments
I am facing the exact same issue. |
I'm facing the same issue when accessing the HTML generated by $ curl https://sdk-bulk-test-endpoint.azureedge.net/bulk-test-details/view/0.0.35/bulkTestDetails.min.js
...
< HTTP/2 409
< date: Tue, 03 Dec 2024 04:49:56 GMT
< content-type: application/xml
< content-length: 248
< x-ms-request-id: 82869c26-e01e-0023-4b3e-452444000000
< x-ms-version: 2009-09-19
< x-azure-ref: 20241203T044956Z-167dd484d77qjrlwhC1TYOa6y80000000ku000000000xcqw
< x-fd-int-roxy-purgeid: 50215840
< x-cache: TCP_MISS
<
<?xml version="1.0" encoding="utf-8"?><Error><Code>PublicAccessNotPermitted</Code><Message>Public access is not permitted on this storage account.
RequestId:82869c26-e01e-0023-4b3e-452444000000
* Connection #0 to host sdk-bulk-test-endpoint.azureedge.net left intact
Time:2024-12-03T04:49:56.9351917Z</Message></Error> |
I am facing the exact same issue too. |
+1 |
When can we expect the issue will be fixed? |
Hello. |
+1 |
+1 |
+1 Thank you for fixing it soon! |
Hello, |
+1 |
Hacky workaround - the |
You saved the day ! Thank you ! |
Hi, we're sending this friendly reminder because we haven't heard back from you in 30 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 7 days of this comment, the issue will be automatically closed. Thank you! |
Still not working without using this hacky workaround :( |
I created this Python script to run pf visualize run, grab the html with the bad link, replace the bad link with a local version of the js file etc... #!/usr/bin/env python3
import argparse
import os
import re
import shutil
import subprocess
import sys
import urllib.request
from datetime import datetime
from bs4 import BeautifulSoup
def get_run_name():
"""Get run name from command line argument or prompt the user"""
parser = argparse.ArgumentParser(description='Visualize a PromptFlow run and modify the HTML output.')
parser.add_argument('--run-name', '-r', help='The name of the run to visualize')
args = parser.parse_args()
run_name = args.run_name
if not run_name:
run_name = input("Enter the run name to visualize: ")
return run_name
def ensure_js_file_exists():
"""Check if flow_visualize.js exists, if not download it"""
js_path = 'flow_visualize.js'
# Build full path from current folder
js_path = os.path.join(os.getcwd(), 'flow_visualize.js')
if not os.path.exists(js_path):
print(f"flow_visualize.js not found at {js_path}, downloading it...")
js_url = "https://raw.githubusercontent.com/microsoft/promptflow/8bc2250ae9231093f1d3f2767a786363caa7e5b0/src/promptflow/promptflow/_sdk/data/bulkTestDetails.min.js"
try:
# Create directory if it doesn't exist
os.makedirs(os.path.dirname(js_path), exist_ok=True)
# Download the file
urllib.request.urlretrieve(js_url, js_path)
print(f"Successfully downloaded flow_visualize.js to {js_path}")
except Exception as e:
print(f"Error downloading flow_visualize.js: {e}")
sys.exit(1)
else:
print(f"flow_visualize.js already exists at {js_path}")
def run_pf_visualize(run_name):
"""Run the pf visualize command and return the output"""
cmd = ["pf", "run", "visualize", "-n", run_name]
print(f"Running command: {' '.join(cmd)}")
try:
result = subprocess.run(cmd, capture_output=True, text=True, check=True)
return result.stdout
except subprocess.CalledProcessError as e:
print(f"Error running pf visualize: {e}")
print(f"Error output: {e.stderr}")
sys.exit(1)
def extract_html_path(output):
"""Extract the HTML file path from the command output"""
match = re.search(r"The HTML file is generated at '([^']+)'", output)
if match:
return match.group(1)
else:
print("Could not find HTML file path in the output:")
print(output)
sys.exit(1)
def copy_html_file(source_path):
"""Copy the HTML file to the local directory with a timestamp"""
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
filename = f"flow_visualization_{timestamp}.html"
try:
shutil.copy2(source_path, filename)
print(f"HTML file copied to: {filename}")
return filename
except Exception as e:
print(f"Error copying file: {e}")
sys.exit(1)
def modify_html_file(filename):
"""Replace the last script tag in the HTML file"""
try:
with open(filename, 'r', encoding='utf-8') as file:
soup = BeautifulSoup(file, 'html.parser')
# Find all script tags
script_tags = soup.find_all('script')
if script_tags:
# Replace the last script tag
new_script = soup.new_tag('script')
new_script['src'] = 'flow_visualize.js'
script_tags[-1].replace_with(new_script)
# Write the modified HTML back to the file
with open(filename, 'w', encoding='utf-8') as file:
file.write(str(soup))
print(f"Successfully modified {filename} - replaced last script tag")
else:
print(f"No script tags found in {filename}")
except Exception as e:
print(f"Error modifying HTML file: {e}")
sys.exit(1)
def main():
# Ensure the JS file exists before proceeding
ensure_js_file_exists()
run_name = get_run_name()
output = run_pf_visualize(run_name)
html_path = extract_html_path(output)
local_file = copy_html_file(html_path)
modify_html_file(local_file)
# Open the modified HTML file in the default web browser
print(f"Opening {local_file} in the default web browser...")
try:
# For macOS
subprocess.run(["open", local_file], check=True)
print("Browser opened successfully.")
except subprocess.CalledProcessError as e:
print(f"Error opening browser: {e}")
print("Please open the HTML file manually.")
print("Process completed successfully!")
if __name__ == "__main__":
main() Works for my needs. |
Hi, we're sending this friendly reminder because we haven't heard back from you in 30 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 7 days of this comment, the issue will be automatically closed. Thank you! |
Describe the bug
After a batch run when we select the visualization feature the vs code shows a blank page.
How To Reproduce the bug
Expected behavior
The visualization of the run.
Screenshots
Its an empty screen. Note I can see the html in the temp folder and when I try to open it a browser I get this in the browser console
"GET https://sdk-bulk-test-endpoint.azureedge.net/bulk-test-details/view/0.0.35/bulkTestDetails.min.js net::ERR_ABORTED 409 (Conflict)"
Running Information(please complete the following information):
pf -v
: [e.g. 0.0.102309906]pf -v
{
"promptflow": "1.16.1",
"promptflow-core": "1.16.1",
"promptflow-devkit": "1.16.1",
"promptflow-tracing": "1.16.1"
}
Executable 'C:\projects\machine_learning\venv\promptflow\Scripts\python.exe'
Python (Windows) 3.11.9 | packaged by Anaconda, Inc. | (main, Apr 19 2024, 16:40:41) [MSC v.1916 64 bit (AMD64)]
Windows 11
python --version
: [e.g. python==3.10.12]python --version
Python 3.11.9
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: