Skip to content

Commit

Permalink
added run command
Browse files Browse the repository at this point in the history
  • Loading branch information
yindia committed Oct 16, 2024
1 parent c3fa1cf commit c174e1f
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion pytask/taskcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import tempfile
import json
import fnmatch

import sys
import importlib
from typing import TypedDict, List, Dict
from enum import Enum

Expand Down Expand Up @@ -110,6 +111,21 @@ def get_function_info(node: ast.FunctionDef) -> Dict[str, Any]:

return configs


@click.command()
@click.argument('task_name', type=str)
def run(task_name: str) -> None:
"""
Run a specified task by name.
Args:
task_name (str): The name of the task to run.
"""
# task_module = importlib.import_module(".")
# task_function = getattr(task_module, task_name)
# task_function()
print(f"Task '{task_name}' executed.") # Placeholder for task execution logic

@click.group(invoke_without_command=True)
@click.argument('dir', type=click.Path(exists=True), nargs=1, required=False, default='.')
@click.option('--image', '-i', help='Specify a custom image')
Expand Down Expand Up @@ -217,5 +233,7 @@ def process_file(file_path: str, custom_image: str = None) -> None:

logger.info(f"Stored task and workflow protos in {output_filename}")

cli.add_command(run) # Register the new command

if __name__ == '__main__':
cli()

0 comments on commit c174e1f

Please sign in to comment.