The job_manager_handler.py module#
Summary#
Synchronous façade that controls an async Job Manager service. |
Return an aiohttp.ClientSession with appropriate TLS configuration. |
|
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
atexitor explicitclose().Thread-safe job submission and cancellation.
Global timeout support for batched workloads.
Zero configuration when used with PyEDB
Edbobjects.
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:
- url
str Base URL; used only to decide whether TLS verification is required.
- url
- Returns:
aiohttp.ClientSessionConfigured 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:
- request
aiohttp.web.Request Incoming HTTP request
- handler
callable() Next handler in the middleware chain
- request
- Returns:
aiohttp.web.ResponseResponse with CORS headers added
- job_manager_handler.parser#