promptflow icon indicating copy to clipboard operation
promptflow copied to clipboard

[BUG] Detail relative pathing requirements

Open stewartadam opened this issue 2 years ago • 4 comments

Describe the bug Further to #1650, when -f is specified and then other CLI arguments are provided to override fields, the behavior of the path resolution changes. Arguments like --data normally are relative to $PWD but once -f is specified, I'm guessing the CLI arguments get merged on top of the schema properties which makes the pathing relative to that file instead.

It would be nice to have this quirk documented (or adjusted so that paths in CLI arguments are always relevant to $PWD which is probably closer to user expected behavior for path arguments of CLI tools in general).

How To Reproduce the bug Steps to reproduce the behavior, how frequent can you experience the bug:

  1. pf run create --data path/to/data --flow path/to/flow ... vs 1. pf run create -f configs/runspec.yml --data ../path/to/override/relative/to/yml

Expected behavior Paths passed via CLI arguments are usually relative to the working directory. If not, that deviation from typical CLI tool behavior should be documented in the --help output and in the documentation.

Screenshots If applicable, add screenshots to help explain your problem.

Running Information(please complete the following information):

  • Promptflow Package Version using pf -v: 1.1.1
  • Operating System: MacOS 14.2.1 (23C71)
  • Python Version using python --version: Python 3.9.18

Additional context Add any other context about the problem here.

stewartadam avatar Jan 09 '24 20:01 stewartadam

Yes, this should be a bug. --data inputs should relative to $PWD, and we'll convert that path to relative to the yaml file internally.

crazygao avatar Jan 10 '24 03:01 crazygao

Hi @stewartadam , after some discussion, we think it is better to reserve current --data ../path/to/override/relative/to/yml and make more documentation for this. A solid reason is that it is more straightforward to make you understand this is just a yaml replacement of the runspec file. If you write code against this method, you'll experience the same behavior with you run the flow through pf commands.

crazygao avatar Jan 10 '24 10:01 crazygao

Hi, we have added some new words in the pf run create --help for better explaination.

crazygao avatar Jan 11 '24 06:01 crazygao

@crazygao did this change apply to pfazure as well? I'm seeing difference in pathing between creating runs locally or on Azure.

It looks like when creating runs on Azure, the path for --data and others must be relative to PWD instead of flow YML location.

promptflow==1.4.1 promptflow-tools==1.1.0 promptflow_vectordb==0.2.3

promptflow 1.4.1 Executable '/opt/conda/bin/python' Python (Linux) 3.9.18 (main, Sep 11 2023, 13:41:44) [GCC 11.2.0]

stewartadam avatar Jan 23 '24 18:01 stewartadam