Skip to content

Add server sub-package for long-running job scheduling and management#113

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/add-socx-server-sub-package
Draft

Add server sub-package for long-running job scheduling and management#113
Copilot wants to merge 3 commits into
mainfrom
copilot/add-socx-server-sub-package

Conversation

Copilot AI commented Dec 4, 2025

Copy link
Copy Markdown

Implements infrastructure for scheduling and managing long-running jobs through a daemon-style server, enabling async execution with status tracking and output capture for CLI/TUI presentation.

Architecture

Core Components:

  • Server: Daemon-style manager with configurable worker pool for concurrent job execution
  • Job: Async execution primitive with UID tracking, output capture, and cancellation support
  • JobCommand: Command specification with working directory and environment customization
  • JobStatus/JobResult: State tracking enumerations (Pending→Running→Completed/Failed/Cancelled)

Key Capabilities:

  • Schedule jobs via schedule_job(name, command, cwd=None, env=None) -> int
  • Query status/results/outputs by job UID
  • Cancel running jobs with graceful termination (SIGTERM → SIGKILL)
  • Worker pool processes queue with configurable concurrency

Usage

from socx import Server

server = Server(max_concurrent=3)

# Schedule jobs
job_id = server.schedule_job(
    "build", 
    "make all",
    cwd=Path("/src"),
    env={"CC": "gcc-13"}
)

# Start processing
await server.run_until_complete()

# Retrieve results
info = server.get_job_info(job_id)
output = server.get_job_output(job_id)  # stdout
error = server.get_job_error(job_id)    # stderr

Implementation Details

  • Uses asyncio subprocess management with PIPE for output capture
  • Worker tasks pull from shared queue with timeout polling to respect shutdown signals
  • Exceptions in job queueing logged via callback; worker failures ensure task_done() via finally block
  • UIDMixin integration for consistent object identification across socx ecosystem

Exposed through main socx module alongside existing regression/pattern primitives.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add a socx "server" sub-package and "Server" class</issue_title>
<issue_description>Add a server sub-package and Server class to support scheduling of long running jobs on a server daemon running on a local/remote machine and later present job statuses, results, outputs, etc. through the command line interface and optionally a TUI if time allows</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 4, 2025 01:56
Co-authored-by: sagikimhi <92639180+sagikimhi@users.noreply.github.com>
Co-authored-by: sagikimhi <92639180+sagikimhi@users.noreply.github.com>
Copilot AI changed the title [WIP] Add server sub-package and Server class for job scheduling Add server sub-package for long-running job scheduling and management Dec 4, 2025
Copilot AI requested a review from sagikimhi December 4, 2025 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a socx "server" sub-package and "Server" class

2 participants