From 7910d6d247ec9cb1b51cd49d79e3d474b087b188 Mon Sep 17 00:00:00 2001 From: barry-jin <69359374+barry-jin@users.noreply.github.com> Date: Fri, 23 Oct 2020 17:28:58 -0700 Subject: [PATCH] [CI] Small fixes to increase test logs readability (#1398) * [CI] Small fixes * [CI] Update unittest-gpu.yml * update --- .github/workflows/unittests-gpu.yml | 18 ++++++++++-------- tools/batch/submit-job.py | 6 +++--- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/unittests-gpu.yml b/.github/workflows/unittests-gpu.yml index d053b6dda4..2bff78cb4c 100644 --- a/.github/workflows/unittests-gpu.yml +++ b/.github/workflows/unittests-gpu.yml @@ -26,8 +26,8 @@ jobs: - name: Install Other Dependencies run: | - python -m pip install --user --quiet --upgrade pip - python -m pip install --user --quiet -e .[extras] + python -m pip install --quiet --upgrade pip + python -m pip install --quiet boto3 - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v1 @@ -45,10 +45,11 @@ jobs: --name GluonNLP-GPU-Test-${{ github.ref }} \ --source-ref ${{ github.ref }} \ --work-dir . \ - --save-path temp \ + --saved-output coverage.xml \ + --save-path coverage.xml \ --remote https://github.com/${{ github.repository }} \ --command "python3 -m pytest --cov=. --cov-config=./.coveragerc --cov-report=xml --durations=50 --device="gpu" --runslow ./tests/" \ - --wait | tee > batch_job.log + --wait | tee batch_job.log - name: Test project on AWS Batch(For pull request) @@ -60,10 +61,11 @@ jobs: --name GluonNLP-GPU-Test-PR#${{ github.event.number }} \ --source-ref ${{ github.event.pull_request.head.ref }} \ --work-dir . \ - --save-path temp \ + --saved-output coverage.xml \ + --save-path coverage.xml \ --remote https://github.com/${{ github.event.pull_request.head.repo.full_name }} \ --command "python3 -m pytest --cov=. --cov-config=./.coveragerc --cov-report=xml --durations=50 --device="gpu" --runslow ./tests/" \ - --wait | tee > batch_job.log + --wait | tee batch_job.log - name: Wait for job and copy files from AWS s3 if: ${{ failure() || success() }} @@ -76,8 +78,8 @@ jobs: cat jobid.log | xargs -i python ./tools/batch/wait-job.py --job-id {} echo "Copy Codecov file" - cat jobid.log | xargs -i aws s3api wait object-exists --bucket gluon-nlp-dev --key batch/{}/temp/coverage.xml - cat jobid.log | xargs -i aws s3 cp s3://gluon-nlp-dev/batch/{}/temp/coverage.xml ./coverage.xml + cat jobid.log | xargs -i aws s3api wait object-exists --bucket gluon-nlp-dev --key batch/{}/coverage.xml + cat jobid.log | xargs -i aws s3 cp s3://gluon-nlp-dev/batch/{}/coverage.xml ./coverage.xml - name: Upload coverage to Codecov run: | diff --git a/tools/batch/submit-job.py b/tools/batch/submit-job.py index 9bbbc6fe81..4ea140bfc2 100644 --- a/tools/batch/submit-job.py +++ b/tools/batch/submit-job.py @@ -91,7 +91,7 @@ def printLogs(logGroupName, logStreamName, startTime): 'startTime': startTime, 'startFromHead': True} - lastTimestamp = 0 + lastTimestamp = startTime - 1 while True: logEvents = cloudwatch.get_log_events(**kwargs) @@ -155,10 +155,10 @@ def main(): describeJobsResponse = batch.describe_jobs(jobs=[jobId]) status = describeJobsResponse['jobs'][0]['status'] if status == 'SUCCEEDED' or status == 'FAILED': - print('=' * 80) - print('Job [{} - {}] {}'.format(jobName, jobId, status)) if logStreamName: startTime = printLogs(logGroupName, logStreamName, startTime) + 1 + print('=' * 80) + print('Job [{} - {}] {}'.format(jobName, jobId, status)) sys.exit(status == 'FAILED') elif status == 'RUNNING':