Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
[CI] Small fixes to increase test logs readability (#1398)
Browse files Browse the repository at this point in the history
* [CI] Small fixes

* [CI] Update unittest-gpu.yml

* update
  • Loading branch information
barry-jin authored Oct 24, 2020
1 parent 46c9d01 commit 7910d6d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/unittests-gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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() }}
Expand All @@ -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: |
Expand Down
6 changes: 3 additions & 3 deletions tools/batch/submit-job.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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':
Expand Down

0 comments on commit 7910d6d

Please sign in to comment.