Skip to content

Commit

Permalink
fix with record method
Browse files Browse the repository at this point in the history
  • Loading branch information
Qing Lan committed May 15, 2024
1 parent 988cb39 commit 527ba4a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/instant_benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ jobs:
run: |
echo "${{ needs.environment-setup.outputs.template }}" >> template.json
python3 instant_benchmark.py --template template.json \
--job ${{ matrix.job }} --instance ${{ inputs.instance }}
--job ${{ matrix.job }} --instance ${{ inputs.instance }} \
--record ${{ inputs.record }}
bash instant_benchmark.sh
- name: Get serving logs
Expand Down
16 changes: 10 additions & 6 deletions tests/integration/instant_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
required=False,
type=str,
help="The current instance name")
parser.add_argument("--record",
required=False,
type=str,
help="Place to record metrics")

parser.add_argument("--job", required=False, type=str, help="The job string")
args = parser.parse_args()
Expand Down Expand Up @@ -232,7 +236,7 @@ def machine_translation(machine_name: str):
return "lmi"


def build_running_script(template, job, instance):
def build_running_script(template, job, instance, record):
with open(template) as f:
template = json.load(f)
job_template = template[job]
Expand All @@ -244,10 +248,9 @@ def build_running_script(template, job, instance):
container = job_template['container']

benchmark_command = []
record_benchmark = (
'python3 record_benchmark.py --template template.json '
'--job ${{ matrix.job }} --instance ${{ inputs.instance }} '
'--model models/test --record ${{ inputs.record }}')
record_benchmark = ('python3 record_benchmark.py --template template.json '
f'--job {job} --instance {instance} '
f'--model models/test --record {record}')

for key, value in job_template['awscurl'].items():
benchmark_command.append(value)
Expand All @@ -273,7 +276,8 @@ def build_running_script(template, job, instance):
command = f"echo \"template={json.dumps(json.dumps(json.dumps(result)))}\" >> $GITHUB_OUTPUT"
sp.call(command, shell=True)
elif args.template and args.job and args.instance:
build_running_script(args.template, args.job, args.instance)
build_running_script(args.template, args.job, args.instance,
args.record)
else:
parser.print_help()
raise ValueError("args not supported")

0 comments on commit 527ba4a

Please sign in to comment.