From a0889e55eac0262d611110d2dae875a9ef6aac22 Mon Sep 17 00:00:00 2001 From: Dongge Liu Date: Tue, 30 Jul 2024 14:25:25 +1000 Subject: [PATCH 1/8] Testing customize PR experiment log --- service/pr_experiment_log.py | 5 +++++ service/run_experiment_cloudbuild.yaml | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 service/pr_experiment_log.py diff --git a/service/pr_experiment_log.py b/service/pr_experiment_log.py new file mode 100644 index 000000000..1390dfffc --- /dev/null +++ b/service/pr_experiment_log.py @@ -0,0 +1,5 @@ +"""Show PR experiment basic info.""" +import logging +import os + +logging.info('PR: %s', os.getenv('PR_NUMBER')) diff --git a/service/run_experiment_cloudbuild.yaml b/service/run_experiment_cloudbuild.yaml index 1bb5b1b6f..8aa462ceb 100644 --- a/service/run_experiment_cloudbuild.yaml +++ b/service/run_experiment_cloudbuild.yaml @@ -27,3 +27,11 @@ availableSecrets: secretManager: - versionName: projects/fuzzbench/secrets/POSTGRES_PASSWORD/versions/1 env: 'POSTGRES_PASSWORD' + +# Generate PR-experiment log content. +- name: 'python:3.10.8' + entrypoint: 'python' + args: + - service/pr_experiment_log.py + env: + - 'PR_NUMBER=${_PR_NUMBER}' From b23bfac8902484f9c6c5aeb4173bf593dac6b02c Mon Sep 17 00:00:00 2001 From: Dongge Liu Date: Tue, 30 Jul 2024 14:26:43 +1000 Subject: [PATCH 2/8] A dummy comment --- service/gcbrun_experiment.py | 1 + 1 file changed, 1 insertion(+) diff --git a/service/gcbrun_experiment.py b/service/gcbrun_experiment.py index f19ab493d..ea3f9c63d 100644 --- a/service/gcbrun_experiment.py +++ b/service/gcbrun_experiment.py @@ -20,6 +20,7 @@ import logging import os import sys +# Dummy # pytype: disable=import-error import github # pylint: disable=import-error From 5b790b3ce460c3548607f507c367522270b6e30d Mon Sep 17 00:00:00 2001 From: Dongge Liu Date: Tue, 30 Jul 2024 14:34:14 +1000 Subject: [PATCH 3/8] Fix yaml structure --- service/run_experiment_cloudbuild.yaml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/service/run_experiment_cloudbuild.yaml b/service/run_experiment_cloudbuild.yaml index 8aa462ceb..2d5a509c4 100644 --- a/service/run_experiment_cloudbuild.yaml +++ b/service/run_experiment_cloudbuild.yaml @@ -20,6 +20,12 @@ steps: secretEnv: - 'POSTGRES_PASSWORD' timeout: 1800s # 30 minutes +- name: 'gcr.io/cloud-builders/docker' + entrypoint: 'python' + args: + - service/pr_experiment_log.py + env: + - 'PR_NUMBER=${_PR_NUMBER}' timeout: 1800s options: logging: CLOUD_LOGGING_ONLY @@ -27,11 +33,3 @@ availableSecrets: secretManager: - versionName: projects/fuzzbench/secrets/POSTGRES_PASSWORD/versions/1 env: 'POSTGRES_PASSWORD' - -# Generate PR-experiment log content. -- name: 'python:3.10.8' - entrypoint: 'python' - args: - - service/pr_experiment_log.py - env: - - 'PR_NUMBER=${_PR_NUMBER}' From 9bd4604590c42c364412e3160680515be68298c2 Mon Sep 17 00:00:00 2001 From: Dongge Liu Date: Tue, 30 Jul 2024 14:58:56 +1000 Subject: [PATCH 4/8] Print customized logs first --- service/run_experiment_cloudbuild.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/service/run_experiment_cloudbuild.yaml b/service/run_experiment_cloudbuild.yaml index 2d5a509c4..8e2fe1a78 100644 --- a/service/run_experiment_cloudbuild.yaml +++ b/service/run_experiment_cloudbuild.yaml @@ -1,4 +1,8 @@ steps: +- name: 'gcr.io/fuzzbench/experiment-runner' + args: [] + env: + - 'PULL_REQUEST_NUMBER=${_PR_NUMBER}' - name: 'gcr.io/cloud-builders/docker' args: - build @@ -13,10 +17,6 @@ steps: - . env: - 'DOCKER_BUILDKIT=1' -- name: 'gcr.io/fuzzbench/experiment-runner' - args: [] - env: - - 'PULL_REQUEST_NUMBER=${_PR_NUMBER}' secretEnv: - 'POSTGRES_PASSWORD' timeout: 1800s # 30 minutes From db878f62c58e3479ee071e54bea3d9aa2229527a Mon Sep 17 00:00:00 2001 From: Dongge Liu Date: Tue, 30 Jul 2024 15:06:56 +1000 Subject: [PATCH 5/8] Fix typo --- service/run_experiment_cloudbuild.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/service/run_experiment_cloudbuild.yaml b/service/run_experiment_cloudbuild.yaml index 8e2fe1a78..098579f56 100644 --- a/service/run_experiment_cloudbuild.yaml +++ b/service/run_experiment_cloudbuild.yaml @@ -1,8 +1,10 @@ steps: -- name: 'gcr.io/fuzzbench/experiment-runner' - args: [] +- name: 'gcr.io/cloud-builders/docker' + entrypoint: 'python' + args: + - service/pr_experiment_log.py env: - - 'PULL_REQUEST_NUMBER=${_PR_NUMBER}' + - 'PR_NUMBER=${_PR_NUMBER}' - name: 'gcr.io/cloud-builders/docker' args: - build @@ -17,15 +19,13 @@ steps: - . env: - 'DOCKER_BUILDKIT=1' +- name: 'gcr.io/fuzzbench/experiment-runner' + args: [] + env: + - 'PULL_REQUEST_NUMBER=${_PR_NUMBER}' secretEnv: - 'POSTGRES_PASSWORD' timeout: 1800s # 30 minutes -- name: 'gcr.io/cloud-builders/docker' - entrypoint: 'python' - args: - - service/pr_experiment_log.py - env: - - 'PR_NUMBER=${_PR_NUMBER}' timeout: 1800s options: logging: CLOUD_LOGGING_ONLY From 8389fa56b7eaa85cfa034d48c404f3f66b1e8946 Mon Sep 17 00:00:00 2001 From: Dongge Liu Date: Tue, 30 Jul 2024 15:19:06 +1000 Subject: [PATCH 6/8] python does not map to python3 --- service/run_experiment_cloudbuild.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/run_experiment_cloudbuild.yaml b/service/run_experiment_cloudbuild.yaml index 098579f56..b31af29e9 100644 --- a/service/run_experiment_cloudbuild.yaml +++ b/service/run_experiment_cloudbuild.yaml @@ -1,6 +1,6 @@ steps: - name: 'gcr.io/cloud-builders/docker' - entrypoint: 'python' + entrypoint: 'python3' args: - service/pr_experiment_log.py env: From a720a1e0cf3112c2357796713f1c11abf21ceb0c Mon Sep 17 00:00:00 2001 From: Dongge Liu Date: Tue, 30 Jul 2024 15:26:39 +1000 Subject: [PATCH 7/8] Config logging level --- service/pr_experiment_log.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/service/pr_experiment_log.py b/service/pr_experiment_log.py index 1390dfffc..6cd2fc4c6 100644 --- a/service/pr_experiment_log.py +++ b/service/pr_experiment_log.py @@ -2,4 +2,7 @@ import logging import os +logging.basicConfig(level=logging.INFO, + format='%(asctime)s - %(levelname)s - %(message)s') + logging.info('PR: %s', os.getenv('PR_NUMBER')) From 08ac8278f0e332c505e644464533fd121d782395 Mon Sep 17 00:00:00 2001 From: Dongge Liu Date: Tue, 30 Jul 2024 15:31:52 +1000 Subject: [PATCH 8/8] It's better to print it --- service/pr_experiment_log.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/service/pr_experiment_log.py b/service/pr_experiment_log.py index 6cd2fc4c6..9bd1988e2 100644 --- a/service/pr_experiment_log.py +++ b/service/pr_experiment_log.py @@ -1,8 +1,4 @@ """Show PR experiment basic info.""" -import logging import os -logging.basicConfig(level=logging.INFO, - format='%(asctime)s - %(levelname)s - %(message)s') - -logging.info('PR: %s', os.getenv('PR_NUMBER')) +print('PR: %s', os.getenv('PR_NUMBER'))