Skip to content
Snippets Groups Projects
Commit bfd3078f authored by dilawar's avatar dilawar :ant:
Browse files

fix: write_text doens't accept newline for <py3.10

parent 205d80b6
No related branches found
No related tags found
No related merge requests found
Pipeline #3626 passed with stages
in 1 minute and 36 seconds
......@@ -91,9 +91,8 @@ def create_pipeline_from_single_script(script: Path) -> Path:
# move the script to this directory.
shutil.copy2(script, pipeline_dir)
script_name = script.name
pipeline_file.write_text(
f"#!/bin/sh\nchmod +x ./{script_name}\n./{script_name}", newline="\n"
)
with pipeline_file.open('w', newline='\n') as outf:
outf.write(f"#!/bin/sh\nchmod +x ./{script_name}\n./{script_name}")
return prepare_archive(pipeline_dir)
......@@ -106,7 +105,8 @@ def create_pipeline_from_command(cmd: str) -> Path:
"""
pipeline_dir = Path(tempfile.mkdtemp(prefix="bitia_"))
pipeline_file = pipeline_dir / g_default_bitia_main_script_name
pipeline_file.write_text(f"#!/bin/sh\n\n{cmd}", newline="\n")
with pipeline_file.open('w', newline='\n') as outf:
outf.write(f"#!/bin/sh\n\n{cmd}")
logging.info("Wrote pipeline %s", pipeline_file.read_text())
return prepare_archive(pipeline_dir)
......@@ -120,10 +120,10 @@ def submit_job(pipeline_zip: Path, server: str):
f"Submitting {pipeline_zip} (size={numbytes/1024.0:.2f} KB) to the {server}"
)
files = {"pipeline_zip": open(str(pipeline_zip), "rb")}
r = session.post(
response = session.post(
f"{server}/api/v1/submit", files=files, data=dict(filename=pipeline_zip), stream=True
)
for line in r.iter_lines():
for line in response.iter_lines():
print(line.decode())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment