MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / submit_task

Function submit_task

scripts/server/post_seko_talk_ar.py:22–50  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

20 "negative_prompt": args.negative_prompt,
21 "image_path": args.image_path,
22 "audio_path": args.audio_path,
23 "save_result_path": args.save_result_path,
24 "seed": args.seed,
25 "video_duration": args.video_duration,
26 }
27 message = {key: value for key, value in message.items() if value is not None}
28 if args.size:
29 message["size"] = args.size
30
31 logger.info(f"submit url: {url}")
32 logger.info(f"message: {message}")
33 response = requests.post(url, json=message, timeout=30)
34 if response.status_code != 200:
35 raise RuntimeError(f"submit failed ({response.status_code}): {response.text}")
36
37 data = response.json()
38 logger.info(f"submit response: {data}")
39 task_id = data.get("task_id")
40 if not task_id:
41 raise RuntimeError(f"submit response has no task_id: {data}")
42 return task_id
43
44
45def wait_task_done(base_url: str, task_id: str, timeout_seconds: int, poll_interval: float) -> dict:
46 status_url = f"{base_url.rstrip('/')}/v1/tasks/{task_id}/status"
47 deadline = time.time() + timeout_seconds
48 while time.time() < deadline:
49 response = requests.get(status_url, timeout=15)
50 if response.status_code != 200:
51 raise RuntimeError(f"status failed ({response.status_code}): {response.text}")
52 status = response.json()
53 task_status = status.get("status")

Callers 1

mainFunction · 0.85

Calls 3

infoMethod · 0.80
postMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected