Job factory
execution.core.job_factory
¶
Job Factory Module
This module provides a factory pattern implementation for creating ETL job instances based on job type strings. It centralizes job registration and creation logic.
JobFactory
¶
Factory class for creating ETL job instances.
This factory implements a registry pattern to manage available job types and provides methods to create job instances with appropriate configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
_job_registry |
Dict[str, Type[BaseGlueETLJob]]
|
Dictionary mapping job type strings to job classes |
__init__()
¶
Initialize the JobFactory with an empty registry and register all available jobs.
get_job_class(job_type: str) -> Type[BaseGlueETLJob]
¶
Retrieve the job class for a given job type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_type
|
str
|
String identifier for the job type |
required |
Returns:
| Type | Description |
|---|---|
Type[BaseGlueETLJob]
|
The job class corresponding to the specified job type |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the job type is not registered |
create_job(job_type: str, args_to_extract: Optional[List[str]] = None) -> BaseGlueETLJob
¶
Create and return an instance of the specified job type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_type
|
str
|
String identifier for the job type to create |
required |
args_to_extract
|
Optional[List[str]]
|
Optional list of arguments to extract from command line. If None, uses default arguments for the job type. |
None
|
Returns:
| Type | Description |
|---|---|
BaseGlueETLJob
|
An initialized instance of the requested job type |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the job type is not registered |
list_available_jobs() -> Dict[str, str]
¶
Get a dictionary of all available job types with their descriptions.
Returns:
| Type | Description |
|---|---|
Dict[str, str]
|
Dictionary mapping job type strings to their descriptions |