Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions python/example/task/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
from render_sdk.workflows import Options, Retry, start, task

# Configure logging
logging.basicConfig(level=logging.INFO)
logging.basicConfig(level=logging.WARNING)
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)


@task
Expand Down Expand Up @@ -57,7 +58,6 @@ async def fan_out(n: int) -> list[int]:


if __name__ == "__main__":
logger.info("Starting Render Tasks example")
try:
start()
except Exception as e:
Expand Down
2 changes: 1 addition & 1 deletion python/render_sdk/workflows/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async def _execute_task(self, task_name: str, input_args: list[Any]) -> Any:

async def execute(self, task_name: str, input_args: list[Any]) -> Any:
"""Execute a task by name with the given input."""
logger.info(f"Starting execution of task: {task_name}")
logger.debug(f"Starting execution of task: {task_name}")

sent_error = False

Expand Down
25 changes: 8 additions & 17 deletions python/render_sdk/workflows/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,16 @@ async def run_async(socket_path: str) -> None:

It gets the input from the server, executes the task, and sends the result back.
"""
logger.info("Starting task runner")
logger.debug("Starting task runner")

# Create client
client = UDSClient(socket_path)

try:
# Get input from server
logger.info("Getting input from server")
logger.debug("Getting task input")
input_response = await client.get_input()

logger.info(f"Input response: {input_response}")

task_name = input_response.task_name
raw_input = input_response.input_

Expand All @@ -50,18 +48,13 @@ async def run_async(socket_path: str) -> None:
else:
input_data = []

logger.info(f"Received input - task: {task_name}, input: {input_data}")

# Create executor and execute task
task_registry = get_task_registry()
executor = TaskExecutor(task_registry, client)

result = await executor.execute(task_name, input_data)

logger.info(f"Task executed successfully with result: {result}")

except Exception as e:
logger.error(f"Task execution failed: {e}")
logger.debug(f"Executing task: {task_name}")
await executor.execute(task_name, input_data)
except Exception:
raise


Expand All @@ -76,7 +69,7 @@ async def register_async(socket_path: str) -> None:
"""
Register all tasks with the server asynchronously.
"""
logger.info("Registering tasks")
logger.debug("Registering tasks")

# Create client
client = UDSClient(socket_path)
Expand Down Expand Up @@ -105,10 +98,10 @@ async def register_async(socket_path: str) -> None:
tasks.append(task_def)

# Register tasks with server
logger.info(f"Registering {len(tasks)} tasks: {[t.name for t in tasks]}")
logger.debug(f"Registering {len(tasks)} tasks: {[t.name for t in tasks]}")
await client.register_tasks(Tasks(tasks=tasks))

logger.info("Tasks registered successfully")
logger.debug("Tasks registered successfully")

except Exception as e:
logger.error(f"Task registration failed: {e}")
Expand Down Expand Up @@ -139,8 +132,6 @@ def start() -> None:
if not socket_path:
raise ValueError("RENDER_SDK_SOCKET_PATH environment variable is required")

logger.info(f"Starting in mode: {mode}")

if mode == "run":
run(socket_path)
elif mode == "register":
Expand Down