Pythonic task execution library for managing shell-oriented subprocesses and organizing executable Python code into CLI-invokable tasks
Overall
score
96%
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.
Install with Tessl CLI
npx tessl i tessl/pypi-invokedocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10