Skip to content

Commit 11f5e42

Browse files
committed
fix: removed Typer types from api component
1 parent 1338f8c commit 11f5e42

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

diracx-api/src/diracx/api/jobs.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import httpx
1515
import zstandard
1616
from DIRACCommon.Core.Utilities.ClassAd.ClassAdLight import ClassAd
17-
from typer import FileText
1817

1918
from diracx.client.aio import AsyncDiracClient
2019
from diracx.client.models import SandboxInfo
@@ -128,22 +127,20 @@ async def download_sandbox(pfn: str, destination: Path, *, client: AsyncDiracCli
128127

129128

130129
@with_client
131-
async def submit_jobs(jdls: list[FileText], *, client: AsyncDiracClient):
130+
async def submit_jobs(jdls: list[str], *, client: AsyncDiracClient):
132131
# Create and upload InputSandboxes from JDLs
133132
for i, jdl in enumerate(jdls):
134-
original_jdl = jdl.read()
135-
136133
# Fix possible lack of brackets
137-
if original_jdl.strip()[0] != "[":
138-
original_jdl = f"[{original_jdl}]"
134+
if jdl.strip()[0] != "[":
135+
jdl = f"[{jdl}]"
139136

140-
class_ad_job = ClassAd(original_jdl)
137+
class_ad_job = ClassAd(jdl)
141138
if class_ad_job.lookupAttribute("InputSandbox"):
142139
isb = class_ad_job.getListFromExpression("InputSandbox")
143140
sandboxes_pfn = await create_sandbox(
144141
paths=[Path(file_path) for file_path in isb]
145142
)
146-
print(f"InputSandbox created: {sandboxes_pfn[13:]}")
143+
logging.info(f"InputSandbox created: {sandboxes_pfn[13:]}")
147144
class_ad_job.set_expression("InputSandbox", {sandboxes_pfn})
148145

149146
jdls[i] = class_ad_job.asJDL()

diracx-cli/src/diracx/cli/jobs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ def display_rich(data, content_range: ContentRange) -> None:
152152

153153
@app.async_command()
154154
async def submit(jdls: list[FileText]):
155-
jobs = await submit_jobs(jdls)
155+
jdls_values = [jdl.read() for jdl in jdls]
156+
157+
jobs = await submit_jobs(jdls_values)
156158
print(
157159
f"Inserted {len(jobs)} jobs with ids: {','.join(map(str, (job.job_id for job in jobs)))}"
158160
)

0 commit comments

Comments
 (0)