Skip to content

Commit 0f28c3f

Browse files
committed
Fix client request, fix dependencies, fix a bug in Makefile
1 parent db62d5f commit 0f28c3f

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ test: $(PYSOURCES) FORCE
150150

151151
## testcov : run the wes-service test suite and collect coverage
152152
testcov: $(PYSOURCES)
153-
python -m pytest -rsx --cov ${PYTEST_EXTRA}
153+
python -m pytest ${PYTEST_EXTRA} -rsx --cov
154154

155155
sloccount.sc: $(PYSOURCES) Makefile
156156
sloccount --duplicates --wide --details $^ > $@

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ classifiers = [
2323
]
2424
requires-python = ">=3.9"
2525
dependencies = [
26-
"connexion[swagger-ui] >= 3, < 4",
26+
"connexion[swagger-ui,flask,uvicorn] >= 3, < 4",
2727
"ruamel.yaml >= 0.15.78",
2828
"schema-salad",
2929
]

test/test_integration.py

-2
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ def setUp(self) -> None:
246246
"--opt",
247247
"runner=cwltool",
248248
"--port=8080",
249-
"--debug",
250249
]
251250
)
252251
time.sleep(5)
@@ -304,7 +303,6 @@ def setUp(self) -> None:
304303
os.path.abspath("wes_service/wes_service_main.py"),
305304
"--backend=wes_service.arvados_wes",
306305
"--port=8080",
307-
"--debug",
308306
]
309307
)
310308
self.client.auth = {

wes_client/util.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def fixpaths(d: Any) -> None:
128128

129129
def build_wes_request(
130130
workflow_file: str, json_path: str, attachments: Optional[list[str]] = None
131-
) -> list[tuple[str, Any]]:
131+
) -> tuple[list[tuple[str, Any]], list[tuple[str, Any]]]:
132132
"""
133133
:param workflow_file: Path to cwl/wdl file. Can be http/https/file.
134134
:param json_path: Path to accompanying json file.
@@ -157,10 +157,12 @@ def build_wes_request(
157157
("workflow_type_version", wf_version),
158158
]
159159

160+
workflow_attachments = []
161+
160162
if workflow_file.startswith("file://"):
161163
if wfbase is None:
162164
wfbase = os.path.dirname(workflow_file[7:])
163-
parts.append(
165+
workflow_attachments.append(
164166
(
165167
"workflow_attachment",
166168
(os.path.basename(workflow_file[7:]), open(workflow_file[7:], "rb")),
@@ -182,9 +184,9 @@ def build_wes_request(
182184
attach_f = urlopen(attachment) # nosec B310
183185
relpath = os.path.basename(attach_f)
184186

185-
parts.append(("workflow_attachment", (relpath, attach_f)))
187+
workflow_attachments.append(("workflow_attachment", (relpath, attach_f)))
186188

187-
return parts
189+
return parts, workflow_attachments
188190

189191

190192
def expand_globs(attachments: Optional[Union[list[str], str]]) -> set[str]:
@@ -275,11 +277,12 @@ def run(
275277
:return: The body of the post result as a dictionary.
276278
"""
277279
attachments = list(expand_globs(attachments))
278-
parts = build_wes_request(wf, jsonyaml, attachments)
280+
parts, attachments = build_wes_request(wf, jsonyaml, attachments)
279281
postresult = requests.post( # nosec B113
280282
f"{self.proto}://{self.host}/ga4gh/wes/v1/runs",
281-
files=parts,
282-
headers=self.auth,
283+
data=parts,
284+
files=attachments,
285+
# headers=self.auth,
283286
)
284287
return wes_response(postresult)
285288

0 commit comments

Comments
 (0)