The job_manager_handler.py module#

Summary#

JobManagerHandler

Synchronous façade that controls an async Job Manager service.

get_session

Return an aiohttp.ClientSession with appropriate TLS configuration.

cors_middleware

CORS middleware for aiohttp server.

Description#

Thread-safe façade for the async ANSYS Job Manager.

This module exposes a synchronous, production-grade entry point to the asynchronous job manager service. A background daemon thread hosts an aiohttp web server that schedules and monitors HFSS/3D-Layout simulations on the local machine or external clusters (SLURM, LSF, PBS, Windows-HPC).

The handler guarantees:

  • Non-blocking start/stop semantics for the caller thread.

  • Graceful shutdown via atexit or explicit close().

  • Thread-safe job submission and cancellation.

  • Global timeout support for batched workloads.

  • Zero configuration when used with PyEDB Edb objects.

Examples#

>>> handler = JobManagerHandler()  
>>> handler.start_service()  
>>> config = handler.create_simulation_config("/path/to/project.aedt")  
>>> job_id = asyncio.run(handler.submit_job(config))  
>>> handler.close()  

For command-line usage:

python -m pyedb.workflows.job_manager.backend.job_manager_handler --host localhost --port 8080

Module detail#

job_manager_handler.get_session(url: str) aiohttp.ClientSession#

Return an aiohttp.ClientSession with appropriate TLS configuration.

Parameters:
urlstr

Base URL; used only to decide whether TLS verification is required.

Returns:
aiohttp.ClientSession

Configured client session with timeout and SSL context.

Notes

The session is configured with: - 30-second total timeout - TLS verification for HTTPS URLs - Connection pooling (limit=20, limit_per_host=10) - Appropriate User-Agent header

async job_manager_handler.cors_middleware(request, handler)#

CORS middleware for aiohttp server.

Parameters:
requestaiohttp.web.Request

Incoming HTTP request

handlercallable()

Next handler in the middleware chain

Returns:
aiohttp.web.Response

Response with CORS headers added

job_manager_handler.parser#