Skip to content

Commit 3db3950

Browse files
authored
use base64 and json to encode batch job payloads (#74)
1 parent 8eb6a24 commit 3db3950

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

launch/make_batch_file.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import base64
12
import csv
23
import json
34
from typing import IO, Any, Dict, List
@@ -11,7 +12,12 @@ def make_batch_input_file(urls: List[str], file: IO[str]):
1112

1213

1314
def make_batch_input_dict_file(inputs: List[Dict[str, Any]], file: IO[str]):
14-
writer = csv.DictWriter(file, fieldnames=["id", "args"], quotechar="'")
15+
writer = csv.DictWriter(file, fieldnames=["id", "args"])
1516
writer.writeheader()
1617
for i, args in enumerate(inputs):
17-
writer.writerow({"id": i, "args": json.dumps(args)})
18+
writer.writerow(
19+
{
20+
"id": i,
21+
"args": base64.b64encode(json.dumps(args).encode("utf-8")),
22+
}
23+
)

0 commit comments

Comments
 (0)