Skip to content

Commit 6d47f72

Browse files
authored
Creating config file symlinks when building out workflow scaffolding with the aiq workflow create command (#166)
Signed-off-by: mpenn <mpenn@nvidia.com>
1 parent 295df13 commit 6d47f72

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

‎src/aiq/cli/commands/workflow/workflow_commands.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ def get_workflow_path_from_name(workflow_name: str):
123123
@click.option(
124124
"--workflow-dir",
125125
default=".",
126-
help="Output directory for saving the created workflow. A new folder with the workflow name will be created within."
127-
"Defaults to the present working directory.")
126+
help="Output directory for saving the created workflow. A new folder with the workflow name will be created "
127+
"within. Defaults to the present working directory.")
128128
@click.option(
129129
"--description",
130130
default="AIQ Toolkit function template. Please update the description.",
@@ -170,6 +170,8 @@ def create_command(workflow_name: str, install: bool, workflow_dir: str, descrip
170170
(new_workflow_dir / 'src' / package_name).mkdir(parents=True)
171171
# Create config directory
172172
(new_workflow_dir / 'src' / package_name / 'configs').mkdir(parents=True)
173+
# Create package level configs directory
174+
(new_workflow_dir / 'configs').mkdir(parents=True)
173175

174176
# Initialize Jinja2 environment
175177
env = Environment(loader=FileSystemLoader(str(template_dir)))
@@ -196,7 +198,6 @@ def create_command(workflow_name: str, install: bool, workflow_dir: str, descrip
196198
'python_safe_workflow_name': workflow_name.replace("-", "_"),
197199
'package_name': package_name,
198200
'rel_path_to_repo_root': rel_path_to_repo_root,
199-
# 'workflow_class_name': f"{workflow_name.capitalize().replace("-", "").replace("_", "")}WorkflowConfig",
200201
'workflow_class_name': f"{_generate_valid_classname(workflow_name)}FunctionConfig",
201202
'workflow_description': description
202203
}
@@ -207,6 +208,11 @@ def create_command(workflow_name: str, install: bool, workflow_dir: str, descrip
207208
with open(output_path, 'w', encoding="utf-8") as f:
208209
f.write(content)
209210

211+
# Create symlink for config.yml
212+
config_source = new_workflow_dir / 'src' / package_name / 'configs' / 'config.yml'
213+
config_link = new_workflow_dir / 'configs' / 'config.yml'
214+
os.symlink(config_source, config_link)
215+
210216
if install:
211217
# Install the new package without changing directories
212218
click.echo(f"Installing workflow '{workflow_name}'...")

0 commit comments

Comments
 (0)