Skip to content

Commit

Permalink
chore(cli): Rename vars
Browse files Browse the repository at this point in the history
  • Loading branch information
HamadaSalhab committed Jan 30, 2025
1 parent 1bf48e7 commit 833f651
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
21 changes: 10 additions & 11 deletions cli/julep_cli/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def create(
console=console
) as progress:
try:
sync_task = progress.add_task("Creating agent...", start=False)
progress.start_task(sync_task)
create_agent_task = progress.add_task("Creating agent...", start=False)
progress.start_task(create_agent_task)

agent = client.agents.create(
name=name,
Expand All @@ -82,7 +82,6 @@ def create(
)

except Exception as e:
progress.remove_task(sync_task)
error_console.print(f"Error creating agent: {e}", style="bold red")
raise typer.Exit(1)

Expand Down Expand Up @@ -153,8 +152,8 @@ def update(
console=console
) as progress:
try:
sync_task = progress.add_task("Updating agent...", start=False)
progress.start_task(sync_task)
update_agent_task = progress.add_task("Updating agent...", start=False)
progress.start_task(update_agent_task)

client.agents.update(agent_id=id, **updates)
except Exception as e:
Expand Down Expand Up @@ -192,8 +191,8 @@ def delete(
console=console
) as progress:
try:
sync_task = progress.add_task("Deleting agent...", start=False)
progress.start_task(sync_task)
delete_agent_task = progress.add_task("Deleting agent...", start=False)
progress.start_task(delete_agent_task)

client.agents.delete(id)
except Exception as e:
Expand Down Expand Up @@ -231,8 +230,8 @@ def list(
console=console
) as progress:
try:
fetch_agents = progress.add_task(description="Fetching agents", total=None)
progress.start_task(fetch_agents)
list_agents_task = progress.add_task(description="Fetching agents", total=None)
progress.start_task(list_agents_task)

agents = client.agents.list(metadata_filter=metadata_filter).items
except Exception as e:
Expand Down Expand Up @@ -289,8 +288,8 @@ def get(
console=console
) as progress:
try:
sync_task = progress.add_task("Retrieving agent...", start=False)
progress.start_task(sync_task)
get_agent_task = progress.add_task("Retrieving agent...", start=False)
progress.start_task(get_agent_task)

agent = client.agents.get(id)
except Exception as e:
Expand Down
21 changes: 12 additions & 9 deletions cli/julep_cli/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,24 @@ def create(
console=console
) as progress:
try:
sync_task = progress.add_task("Creating task...", start=False)
progress.start_task(sync_task)
create_task_task = progress.add_task("Creating task...", start=False)
progress.start_task(create_task_task)

task = client.tasks.create(
agent_id=agent_id,
**task_yaml_contents,
)

except Exception as e:
progress.remove_task(sync_task)
error_console.print(f"Error creating task: {e}", style="bold red")
raise typer.Exit(1)

console.print(Text(f"Task created successfully. Task ID: {
task.id}", style="bold green"))
console.print(
Text(
f"Task created successfully. Task ID: {task.id}",
style="bold green"
)
)


@tasks_app.command()
Expand Down Expand Up @@ -159,8 +162,8 @@ def update(
console=console
) as progress:
try:
sync_task = progress.add_task("Updating task...", start=False)
progress.start_task(sync_task)
update_task_task = progress.add_task("Updating task...", start=False)
progress.start_task(update_task_task)

client.tasks.create_or_update(agent_id=agent_id, task_id=task_id, **task_yaml_contents)
except Exception as e:
Expand Down Expand Up @@ -190,9 +193,9 @@ def list(
console=console
) as progress:
try:
fetch_tasks = progress.add_task(
list_tasks_task = progress.add_task(
description="Fetching tasks", total=None)
progress.start_task(fetch_tasks)
progress.start_task(list_tasks_task)

tasks = client.tasks.list(agent_id=agent_id).items
except Exception as e:
Expand Down

0 comments on commit 833f651

Please sign in to comment.