prefect_aws.glue_job
¶
Integrations with the AWS Glue Job.
GlueJobBlock
¶
Bases: JobBlock
Execute a job to the AWS Glue Job service.
Attributes:
Name | Type | Description |
---|---|---|
job_name |
str
|
The name of the job definition to use. |
arguments |
Optional[dict]
|
The job arguments associated with this run. For this job run, they replace the default arguments set in the job definition itself. You can specify arguments here that your own job-execution script consumes, as well as arguments that Glue itself consumes. Job arguments may be logged. Do not pass plaintext secrets as arguments. Retrieve secrets from a Glue Connection, Secrets Manager or other secret management mechanism if you intend to keep them within the Job. doc |
job_watch_poll_interval |
float
|
The amount of time to wait between AWS API calls while monitoring the state of a Glue Job. default is 60s because of jobs that use AWS Glue versions 2.0 and later have a 1-minute minimum. AWS Glue Pricing |
Example
Start a job to AWS Glue Job.
from prefect import flow
from prefect_aws import AwsCredentials
from prefect_aws.glue_job import GlueJobBlock
@flow
def example_run_glue_job():
aws_credentials = AwsCredentials(
aws_access_key_id="your_access_key_id",
aws_secret_access_key="your_secret_access_key"
)
glue_job_run = GlueJobBlock(
job_name="your_glue_job_name",
arguments={"--YOUR_EXTRA_ARGUMENT": "YOUR_EXTRA_ARGUMENT_VALUE"},
).trigger()
return glue_job_run.wait_for_completion()
example_run_glue_job()
Source code in prefect_aws/glue_job.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
|
trigger
async
¶
trigger for GlueJobRun
Source code in prefect_aws/glue_job.py
155 156 157 158 159 160 161 162 163 |
|
GlueJobRun
¶
Bases: JobRun
, BaseModel
Execute a Glue Job
Source code in prefect_aws/glue_job.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
fetch_result
async
¶
fetch glue job state
Source code in prefect_aws/glue_job.py
56 57 58 59 |
|
wait_for_completion
¶
Wait for the job run to complete and get exit code
Source code in prefect_aws/glue_job.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|