Skip to content
Merged
Changes from all 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
10 changes: 8 additions & 2 deletions launch/make_batch_file.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import base64
import csv
import json
from typing import IO, Any, Dict, List
Expand All @@ -11,7 +12,12 @@ def make_batch_input_file(urls: List[str], file: IO[str]):


def make_batch_input_dict_file(inputs: List[Dict[str, Any]], file: IO[str]):
writer = csv.DictWriter(file, fieldnames=["id", "args"], quotechar="'")
writer = csv.DictWriter(file, fieldnames=["id", "args"])
writer.writeheader()
for i, args in enumerate(inputs):
writer.writerow({"id": i, "args": json.dumps(args)})
writer.writerow(
{
"id": i,
"args": base64.b64encode(json.dumps(args).encode("utf-8")),
}
)