Skip to content

Update test_factorization_machines.py #35

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

Open
wants to merge 19 commits into
base: master-workflows
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/Trigger-codebuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Trigger CodeBuild Job

on:
workflow_call:
inputs:
codeBuildProjectName:
required: true
type: string
prNumber:
required: true
type: number
commitSha:
required: true
type: string
secrets:
CI_AWS_ROLE_ARN:
required: true

concurrency:
group: ${{ github.workflow }}-${{ inputs.prNumber }}
cancel-in-progress: true

permissions:
id-token: write # This is required for requesting the JWT

jobs:
slow-mode-tests:
runs-on: ubuntu-latest
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }}
aws-region: us-west-2
role-duration-seconds: 10800
- name: Run Test
uses: aws-actions/aws-codebuild-run-build@v1
with:
project-name: ${{ inputs.codeBuildProjectName}}
source-version-override: 'refs/pull/${{ inputs.prNumber }}/head^{${{ inputs.commitSha }}}'
4 changes: 2 additions & 2 deletions .github/workflows/codebuild-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: actions/github-script@v7
id: collab-check
env:
PR_USER_LOGIN: ${{ github.event.pull_request.user.login }}
GH_USER_LOGIN: ${{ github.event.pull_request.user.login }}
with:
github-token: ${{ secrets.COLLAB_CHECK_TOKEN }}
result-encoding: string
Expand All @@ -35,7 +35,7 @@ jobs:
const res = await github.rest.repos.checkCollaborator({
owner: context.repo.owner,
repo: context.repo.repo,
username: "${{ env.PR_USER_LOGIN }}",
username: "${{ env.GH_USER_LOGIN }}",
});
console.log("Verifed user is a repo collaborator. Auto Approving PR Checks.")
return res.status == "204" ? "auto-approve" : "manual-approval"
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/run-extras.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Run Extras

on:
pull_request_review:
types: [submitted]

permissions:
id-token: write # This is required for requesting the JWT

jobs:
check-comment:
if: github.event.review.body == '/run slow' || github.event.review.body == '/run localmode' || github.event.review.body == '/run extras'
runs-on: ubuntu-latest
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.MONITORING_AWS_ROLE_ARN }}
aws-region: us-west-2
- name: Collaborator Check
uses: actions/github-script@v7
id: collab-check
env:
GH_USER_LOGIN: ${{ github.event.review.user.login }}
with:
github-token: ${{ secrets.COLLAB_CHECK_TOKEN }}
result-encoding: string
script: |
try {
const res = await github.rest.repos.checkCollaborator({
owner: context.repo.owner,
repo: context.repo.repo,
username: "${{ env.GH_USER_LOGIN }}",
});
console.log("Verifed user is a repo collaborator.")
return
} catch (error) {
if (error.message == "Bad credentials") {
console.log("Token Expired. Please update the COLLAB_CHECK_TOKEN secret.")
const { execSync } = require('child_process')
execSync('aws cloudwatch put-metric-data --namespace "GitHubActions" --metric-name "BadCredentials" --value 1')
}
throw new Error("Collaborator status could not be verified.")
}
run-slow-tests:
needs: [check-comment]
if: needs.check-comment.result == 'success' && github.event.review.body == '/run slow' || github.event.review.body == '/run extras'
uses: ./.github/workflows/trigger-codebuild.yml
secrets:
CI_AWS_ROLE_ARN: ${{ secrets.CI_AWS_ROLE_ARN }}
with:
codeBuildProjectName: "${{ github.repository.name }}-ci-slow-tests"
prNumber: ${{ github.event.pull_request.number }}
commitSha: ${{ github.event.pull_request.head.sha }}
run-localmode-tests:
needs: [check-comment]
if: needs.check-comment.result == 'success' && github.event.review.body == '/run localmode' || github.event.review.body == '/run extras'
uses: ./.github/workflows/trigger-codebuild.yml
secrets:
CI_AWS_ROLE_ARN: ${{ secrets.CI_AWS_ROLE_ARN }}
with:
codeBuildProjectName: "${{ github.repository.name }}-ci-localmode-tests"
prNumber: ${{ github.event.pull_request.number }}
commitSha: ${{ github.event.pull_request.head.sha }}
35 changes: 0 additions & 35 deletions .github/workflows/run-local-mode-tests.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/run-slow-tests.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/trigger-codebuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Trigger CodeBuild Job

on:
workflow_call:
inputs:
codeBuildProjectName:
required: true
type: string
prNumber:
required: true
type: number
commitSha:
required: true
type: string
secrets:
CI_AWS_ROLE_ARN:
required: true

concurrency:
group: ${{ github.workflow }}-${{ inputs.prNumber }}
cancel-in-progress: true

permissions:
id-token: write # This is required for requesting the JWT

jobs:
slow-mode-tests:
runs-on: ubuntu-latest
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }}
aws-region: us-west-2
role-duration-seconds: 10800
- name: Run Test
uses: aws-actions/aws-codebuild-run-build@v1
with:
project-name: ${{ inputs.codeBuildProjectName}}
source-version-override: 'refs/pull/${{ inputs.prNumber }}/head^{${{ inputs.commitSha }}}'
2 changes: 1 addition & 1 deletion tests/integ/test_factorization_machines.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_factorization_machines(sagemaker_session, cpu_instance_type, training_s
)
predictor = model.deploy(1, cpu_instance_type, endpoint_name=job_name)
result = predictor.predict(training_set[0][:10])

# Random Test
assert len(result) == 10
for record in result:
assert record.label["score"] is not None
Expand Down
Loading