class JobBase
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Glue.Alpha.JobBase |
Go | github.com/aws/aws-cdk-go/awscdkgluealpha/v2#JobBase |
Java | software.amazon.awscdk.services.glue.alpha.JobBase |
Python | aws_cdk.aws_glue_alpha.JobBase |
TypeScript (source) | @aws-cdk/aws-glue-alpha 禄 JobBase |
Implements
IConstruct
, IDependable
, IResource
, IJob
, IGrantable
Extends
Resource
Implemented by
Py
, Py
, Py
, Python
, Ray
, Scala
, Scala
, Scala
A base class is needed to be able to import existing Jobs into a CDK app to reference as part of a larger stack or construct.
JobBase has the subset of attribtues required to idenitfy and reference an existing Glue Job, as well as some CloudWatch metric conveneince functions to configure an event-driven flow using the job.
Initializer
new JobBase(scope: Construct, id: string, props?: ResourceProps)
Parameters
- scope
Construct
- id
string
- props
Resource
Props
Properties
Name | Type | Description |
---|---|---|
env | Resource | The environment this resource belongs to. |
grant | IPrincipal | The principal to grant permissions to. |
job | string | The ARN of the job. |
job | string | The name of the job. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
grantPrincipal
Type:
IPrincipal
The principal to grant permissions to.
jobArn
Type:
string
The ARN of the job.
jobName
Type:
string
The name of the job.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
metric(metricName, type, props?) | Create a CloudWatch metric. |
metric | Return a CloudWatch Metric indicating job failure. |
metric | Return a CloudWatch Metric indicating job success. |
metric | Return a CloudWatch Metric indicating job timeout. |
on | Create a CloudWatch Event Rule for this Glue Job when it's in a given state. |
on | Return a CloudWatch Event Rule matching FAILED state. |
on | Create a CloudWatch Event Rule matching JobState.SUCCEEDED. |
on | Return a CloudWatch Event Rule matching TIMEOUT state. |
to | Returns a string representation of this construct. |
protected build | Returns the job arn. |
protected on | Create a CloudWatch Event Rule for the transition into the input jobState. |
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
metric(metricName, type, props?)
public metric(metricName: string, type: MetricType, props?: MetricOptions): Metric
Parameters
- metricName
string
鈥� name of the metric typically prefixed withglue.driver.
,glue.<executorId>.
orglue.ALL.
. - type
Metric
鈥� the metric type.Type - props
Metric
鈥� metric options.Options
Returns
Create a CloudWatch metric.
See also: https://docs.aws.amazon.com/glue/latest/dg/monitoring-awsglue-with-cloudwatch-metrics.html
metricFailure(props?)
public metricFailure(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Return a CloudWatch Metric indicating job failure.
This metric is based on the Rule returned by no-args onFailure() call.
metricSuccess(props?)
public metricSuccess(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Return a CloudWatch Metric indicating job success.
This metric is based on the Rule returned by no-args onSuccess() call.
metricTimeout(props?)
public metricTimeout(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Return a CloudWatch Metric indicating job timeout.
This metric is based on the Rule returned by no-args onTimeout() call.
onEvent(id, options?)
public onEvent(id: string, options?: OnEventOptions): Rule
Parameters
- id
string
鈥� construct id. - options
On
鈥� event options.Event Options
Returns
Create a CloudWatch Event Rule for this Glue Job when it's in a given state.
See also: https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/EventTypes.html#glue-event-types
onFailure(id, options?)
public onFailure(id: string, options?: OnEventOptions): Rule
Parameters
- id
string
鈥� construct id. - options
On
鈥� optional event options.Event Options
Returns
Return a CloudWatch Event Rule matching FAILED state.
onSuccess(id, options?)
public onSuccess(id: string, options?: OnEventOptions): Rule
Parameters
- id
string
鈥� construct id. - options
On
鈥� optional event options.Event Options
Returns
Create a CloudWatch Event Rule matching JobState.SUCCEEDED.
onTimeout(id, options?)
public onTimeout(id: string, options?: OnEventOptions): Rule
Parameters
- id
string
鈥� construct id. - options
On
鈥� optional event options.Event Options
Returns
Return a CloudWatch Event Rule matching TIMEOUT state.
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
protected buildJobArn(scope, jobName)
protected buildJobArn(scope: Construct, jobName: string): string
Parameters
- scope
Construct
- jobName
string
Returns
string
Returns the job arn.
protected onStateChange(id, jobState, options?)
protected onStateChange(id: string, jobState: JobState, options?: OnEventOptions): Rule
Parameters
- id
string
鈥� construct id. - jobState
Job
鈥� the job state.State - options
On
鈥� optional event options.Event Options
Returns
Create a CloudWatch Event Rule for the transition into the input jobState.