tessl install tessl/pypi-invoke@2.2.0Pythonic task execution library for managing shell-oriented subprocesses and organizing executable Python code into CLI-invokable tasks
Agent Success
Agent success rate when using this tile
96%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.25x
Baseline
Agent success rate without this tile
77%
Build a task automation system that can execute multiple long-running background tasks concurrently and collect their results. The system should support starting tasks asynchronously, monitoring their progress, and waiting for their completion.
Implement a TaskManager class that can:
The system should be able to:
sleep 2 && echo "Task complete") without blockingWhen managing multiple tasks:
Support running a background task using a context manager pattern where:
@generates
class TaskManager:
"""Manages asynchronous task execution using shell commands."""
def __init__(self, context):
"""
Initialize the task manager.
Args:
context: The execution context for running commands
"""
pass
def start_task(self, command):
"""
Start a command as a background task without blocking.
Args:
command: Shell command to execute
Returns:
A promise object representing the running task
"""
pass
def run_tasks_parallel(self, commands):
"""
Execute multiple commands concurrently and collect all results.
Args:
commands: List of shell commands to execute
Returns:
List of results in the same order as commands
"""
pass
def run_with_background_task(self, background_cmd, foreground_cmd):
"""
Execute a background command using context manager pattern while
running a foreground command, automatically cleaning up the background task.
Args:
background_cmd: Command to run in background
foreground_cmd: Command to run in foreground
Returns:
Tuple of (background_result, foreground_result)
"""
passProvides task execution and automation support.