Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(stepfunctions-tasks): add step functions task to run glue job #6258

Merged
merged 21 commits into from
Mar 2, 2020
Merged

feat(stepfunctions-tasks): add step functions task to run glue job #6258

merged 21 commits into from
Mar 2, 2020

Conversation

BenChaimberg
Copy link
Contributor

  • add new task RunGlueJobTask and associated unit tests
  • since Job construct does not yet exist, uses job name as required parameter

closes #5266

Pull Request Checklist

  • Testing
    • Unit test added (prefer not to modify an existing test, otherwise, it's probably a breaking change)
    • CLI change?: coordinate update of integration tests with team
    • cdk-init template change?: coordinated update of integration tests with team
  • Docs
    • jsdocs: All public APIs documented
    • README: README and/or documentation topic updated
    • Design: For significant features, design document added to design folder
  • Title and Description
    • Change type: title prefixed with fix, feat and module name in parens, which will appear in changelog
    • Title: use lower-case and doesn't end with a period
    • Breaking?: last paragraph: "BREAKING CHANGE: <describe what changed + link for details>"
    • Issues: Indicate issues fixed via: "Fixes #xxx" or "Closes #xxx"
  • Sensitive Modules (requires 2 PR approvers)
    • IAM Policy Document (in @aws-cdk/aws-iam)
    • EC2 Security Groups and ACLs (in @aws-cdk/aws-ec2)
    • Grant APIs (only if not based on official documentation with a reference)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

* add new task RunGlueJobTask and associated unit tests
* since Job construct does not yet exist, uses job name as required parameter

closes #5266
Copy link
Contributor

@nija-at nija-at left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies about the late response on this.

How hard would it be to add an integration test that sets up a simple glue job and a simple state machine that calls it? Also, to add a couple of statements as described here on how to verify that it actually worked.

@mergify mergify bot dismissed nija-at’s stale review February 21, 2020 23:49

Pull request has been modified.

@BenChaimberg BenChaimberg requested a review from nija-at February 22, 2020 00:06
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 402a76c
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 56d8371
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: f4285b3
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 442f2cd
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 48fc836
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

packages/@aws-cdk/aws-stepfunctions/README.md Show resolved Hide resolved
"@aws-cdk/aws-iam": "999.0.0",
"@aws-cdk/aws-kms": "999.0.0",
"@aws-cdk/aws-lambda": "999.0.0",
"@aws-cdk/aws-s3": "999.0.0",
"@aws-cdk/aws-s3-assets": "999.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make this a devdependency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so...I'm still a node noob but since it's only used for integration testing, that would make sense. I'll also remove it from "dependencies", but let me know if that's incorrect.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 004ebd7
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot dismissed nija-at’s stale review February 26, 2020 23:56

Pull request has been modified.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: bf5f39a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: becef82
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@nija-at
Copy link
Contributor

nija-at commented Feb 28, 2020

@BenChaimberg - I've gone ahead and cleaned up the note about cold start. Hope you don't mind.

Approving momentarily. From this point, on avoid merging from master, i.e., clicking 'Update branch'. mergify will take this forward automatically.

nija-at
nija-at previously approved these changes Feb 28, 2020
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 7db0ab0
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Feb 28, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 45bfbd5
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@nija-at nija-at dismissed their stale review February 28, 2020 14:58

one more comment

Comment on lines 88 to 94
resources: ["*"],
actions: [
"glue:StartJobRun",
"glue:GetJobRun",
"glue:GetJobRuns",
"glue:BatchStopJobRun"
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, there's something I missed here.

Can we reduce the scope of this to just the glue job's ARN?

Also, why does this task need BatchStopJobRun access?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chose these permissions because they are the same as those created by Step Functions when a state machine with a glue task is created in the console. The BatchStopJobRun is required for stopping the glue job if the state machine execution is cancelled.

I didn't think it was possible to specify a resource for these permissions because the Glue docs state that "Glue doesn't allow ARNs for [...] job runs". But I changed the permissions and it seems to work fine for starting the run, realizing the run has finished, and stopping the run.

Since the permissions are different for the different service integration patterns (fire and forget vs. sync), I also added a conditional that sets the appropriate set based on the specified pattern.

@mergify mergify bot dismissed nija-at’s stale review February 28, 2020 20:10

Pull request has been modified.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 2b41dbc
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Mar 2, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 6960a54
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Mar 2, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 15d9bd7 into aws:master Mar 2, 2020
@BenChaimberg BenChaimberg deleted the glue_job_sfn_task branch March 2, 2020 18:25
eladb pushed a commit that referenced this pull request Mar 9, 2020
…6258)

* feat(stepfunctions-tasks): add step functions task to run glue job

* add new task RunGlueJobTask and associated unit tests
* since Job construct does not yet exist, uses job name as required parameter

closes #5266

* cleanup constructor properties, add integration test

* remove job run ID from props, update default prop descriptions

* add s3 assets package to module

* fix linting errors

* clean up documentation, add links to docs and glue task example

* add verification step to integration step, ensure job succeeds

* update expected integration test stack (asset names)

* add integ test verification comment about glue cold start

* cleaned up the note around cold start

* specify glue job ARN in state machine role permissions

* change state machine role permissions based on service integration pattern

Co-authored-by: Niranjan Jayakar <16217941+nija-at@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-stepfunctions-tasks for starting Glue job run
3 participants