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

Migrate the yaml used by the eager flow to flow.flex.yaml, code support both flow.flex.yaml and flow.dag.yaml. #2548

Merged
merged 52 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
a929c00
rename flow.dag.yaml to flow.flex.yaml
Stephen1993 Mar 29, 2024
550af51
support flex yaml
Stephen1993 Apr 1, 2024
b8d6de2
support flex yaml
Stephen1993 Apr 1, 2024
4043b43
merge main
Stephen1993 Apr 1, 2024
46d2f16
update code
Stephen1993 Apr 1, 2024
03076a5
Merge branch 'main' into support_flex_yaml
Stephen1993 Apr 2, 2024
d887868
fix test
Stephen1993 Apr 2, 2024
2a6ec3c
fix test
Stephen1993 Apr 2, 2024
e238c5a
merge main
Stephen1993 Apr 2, 2024
c690ad0
fix test
Stephen1993 Apr 2, 2024
0c86f7d
fix test
Stephen1993 Apr 2, 2024
ce11e7d
fix test
Stephen1993 Apr 2, 2024
76c7c4e
fix test
Stephen1993 Apr 3, 2024
6bd77ed
merge main
Stephen1993 Apr 3, 2024
b62b274
distinguish flex and dag flow
Stephen1993 Apr 3, 2024
c0397d6
distinguish flex and dag flow
Stephen1993 Apr 3, 2024
0b63783
distinguish flex and dag flow
Stephen1993 Apr 3, 2024
b6838c3
distinguish flex and dag flow
Stephen1993 Apr 3, 2024
b4cc0a4
distinguish flex and dag flow
Stephen1993 Apr 7, 2024
614c5ab
distinguish flex and dag flow
Stephen1993 Apr 7, 2024
dd44baa
fix test
Stephen1993 Apr 7, 2024
a6023fd
delete DAG_FILE_NAME constant
Stephen1993 Apr 7, 2024
6cb9882
fix test
Stephen1993 Apr 7, 2024
c793fbc
merge main
Stephen1993 Apr 7, 2024
7023530
fix test
Stephen1993 Apr 7, 2024
85e88fd
update code
Stephen1993 Apr 7, 2024
3405a81
update code
Stephen1993 Apr 7, 2024
197b8d5
Merge branch 'main' into delete_DAG_FILE_NAME_constant
Stephen1993 Apr 8, 2024
d0b8d44
update code
Stephen1993 Apr 8, 2024
524d6b5
update code
Stephen1993 Apr 8, 2024
d0fa7da
update code
Stephen1993 Apr 8, 2024
e88b056
merge delete_DAG_FILE_NAME_constant
Stephen1993 Apr 8, 2024
294f8a7
merge main
Stephen1993 Apr 8, 2024
e7a19b9
merge main
Stephen1993 Apr 8, 2024
9438f0e
Merge branch 'delete_DAG_FILE_NAME_constant' into support_flex_yaml
Stephen1993 Apr 8, 2024
419b856
update code
Stephen1993 Apr 8, 2024
0432ac7
update code
Stephen1993 Apr 8, 2024
e361eb3
update code
Stephen1993 Apr 8, 2024
41be065
merge main
Stephen1993 Apr 8, 2024
26ed512
fix test
Stephen1993 Apr 8, 2024
352a87b
update code
Stephen1993 Apr 8, 2024
854d450
fix test
Stephen1993 Apr 8, 2024
50c7558
fix test
Stephen1993 Apr 8, 2024
fdf4ec3
fix test
Stephen1993 Apr 8, 2024
dee81ab
fix test
Stephen1993 Apr 8, 2024
e3c59f6
fix test
Stephen1993 Apr 8, 2024
1982939
fix test
Stephen1993 Apr 8, 2024
1a69bed
fix test
Stephen1993 Apr 9, 2024
f676702
Merge branch 'main' into support_flex_yaml
Stephen1993 Apr 9, 2024
dccc398
update code
Stephen1993 Apr 9, 2024
6d4beba
update code
Stephen1993 Apr 9, 2024
1782f8a
merge main
Stephen1993 Apr 9, 2024
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
3 changes: 2 additions & 1 deletion src/promptflow-core/promptflow/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
LANGUAGE_KEY = "language"
USER_AGENT_OVERRIDE_KEY = "user_agent_override"

DEFAULT_FLOW_YAML_FILE_NAME = "flow.dag.yaml"
FLOW_DAG_YAML = "flow.dag.yaml"
FLOW_FLEX_YAML = "flow.flex.yaml"

CHAT_HISTORY = "chat_history"

Expand Down
30 changes: 20 additions & 10 deletions src/promptflow-core/promptflow/_utils/flow_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
from pathlib import Path
from typing import Optional, Tuple, Union

from promptflow._constants import CHAT_HISTORY, DEFAULT_ENCODING, DEFAULT_FLOW_YAML_FILE_NAME, PROMPT_FLOW_DIR_NAME
from promptflow._constants import CHAT_HISTORY, DEFAULT_ENCODING, FLOW_DAG_YAML, FLOW_FLEX_YAML, PROMPT_FLOW_DIR_NAME
from promptflow._core._errors import MetaFileNotFound, MetaFileReadError
from promptflow._utils.logger_utils import LoggerFactory
from promptflow._utils.utils import strip_quotation
from promptflow._utils.yaml_utils import dump_yaml, load_yaml
from promptflow.contracts.flow import Flow as ExecutableFlow
from promptflow.exceptions import ErrorTarget, UserErrorException
from promptflow.exceptions import ErrorTarget, UserErrorException, ValidationException
from promptflow.tracing._utils import serialize

logger = LoggerFactory.get_logger(name=__name__)
Expand Down Expand Up @@ -75,15 +75,25 @@ def resolve_flow_path(
else:
flow_path = Path(flow_path)

if flow_path.is_dir():
target_folder = flow_path
target_filer = FLOW_FLEX_YAML if (target_folder / FLOW_FLEX_YAML).is_file() else FLOW_DAG_YAML
if (target_folder / FLOW_DAG_YAML).is_file() and (target_folder / FLOW_FLEX_YAML).is_file():
Stephen1993 marked this conversation as resolved.
Show resolved Hide resolved
raise ValidationException(
Stephen1993 marked this conversation as resolved.
Show resolved Hide resolved
f"Both exist {FLOW_DAG_YAML} and {FLOW_FLEX_YAML} in the {flow_path}. "
f"Please specify the file instead of the folder, "
f"or delete the excess yaml file.",
privacy_info=[str(flow_path)],
)
else:
target_folder = flow_path.parent
target_filer = flow_path.name

if new:
if flow_path.is_dir():
return flow_path, DEFAULT_FLOW_YAML_FILE_NAME
return flow_path.parent, flow_path.name

if flow_path.is_dir() and (flow_path / DEFAULT_FLOW_YAML_FILE_NAME).is_file():
return flow_path, DEFAULT_FLOW_YAML_FILE_NAME
elif flow_path.is_file():
return flow_path.parent, flow_path.name
return target_folder, target_filer

if (target_folder / target_filer).is_file():
return target_folder, target_filer

raise FileNotFoundError(f"Can't find flow with path {flow_path.as_posix()}.")

Expand Down
Loading