The submit_batch_jobs.py module#

Summary#

scan_projects

Scan a directory for AEDB folders and AEDT files.

submit_single_job

Submit a single job to the job manager.

submit_batch_jobs

Submit multiple jobs asynchronously to the job manager.

parse_cli

Parse command-line arguments.

main

Main entry point for the batch job submission script.

Description#

Submit multiple HFSS jobs to the local job-manager service by scanning a directory. Job submissions are done via REST API asynchronously. The service must be running locally (default: localhost:8080) prior to executing this script. To start the service, run this command in another terminal:

python -m pyedb.workflows.job_manager.backend.job_manager_handler

Usage examples#

# Get help python submit_batch_jobs.py –help

# Submit all projects in a directory with explicit values python submit_batch_jobs.py –host 127.0.0.1 –port 8080 –root-dir “D:Temptest_jobs” –num-cores 8

# Use defaults (localhost:8080, 8 cores) python submit_batch_jobs.py –root-dir “D:Temptest_jobs”

# Recursive scan python submit_batch_jobs.py –root-dir “D:Temptest_jobs” –recursive

Module detail#

submit_batch_jobs.scan_projects(root_dir: pathlib.Path, recursive: bool = False) List[pathlib.Path]#

Scan a directory for AEDB folders and AEDT files.

For each AEDB folder found, check if a corresponding AEDT file exists. If it does, use the AEDT file; otherwise, use the AEDB folder.

Parameters:
root_dirPath

Root directory to scan for projects.

recursivebool, optional

If True, scan subdirectories recursively. Default is False.

Returns:
List[Path]

List of project paths (either .aedt files or .aedb folders) to submit.

async submit_batch_jobs.submit_single_job(session: aiohttp.ClientSession, backend_url: str, project_path: pathlib.Path, num_cores: int, priority: int = 0) tuple[pathlib.Path, bool, Any]#

Submit a single job to the job manager.

Parameters:
sessionaiohttp.ClientSession

Async HTTP session for making requests.

backend_urlstr

Base URL of the job manager service.

project_pathPath

Path to the project file or folder.

num_coresint

Number of CPU cores to allocate.

priorityint, optional

Job priority (default: 0).

Returns:
tuple[Path, bool, Any]

Tuple of (project_path, success_flag, response_data).

async submit_batch_jobs.submit_batch_jobs(*, host: str, port: int, projects: List[pathlib.Path], num_cores: int, max_concurrent: int = 5, delay_ms: int = 100) None#

Submit multiple jobs asynchronously to the job manager.

Parameters:
hoststr

Job manager host address.

portint

Job manager port.

projectsList[Path]

List of project paths to submit.

num_coresint

Number of CPU cores to allocate per job.

max_concurrentint, optional

Maximum number of concurrent submissions (default: 5).

delay_msint, optional

Delay in milliseconds between job submissions (default: 100).

submit_batch_jobs.parse_cli() argparse.Namespace#

Parse command-line arguments.

submit_batch_jobs.main() None#

Main entry point for the batch job submission script.

submit_batch_jobs.logger#