Found by a Codex global repository scan of deepmodeling/dpdispatcher at commit 98a9e08.
Problem
The cloud client overwrites an explicit constructor ticket from BOHR_TICKET on every request/refresh, and it tracks log download offset in one shared integer across all jobs.
Relevant code
|
self.last_log_offset = 0 |
|
self.ticket = ticket |
|
if not self.token: |
|
self.refresh_token() |
|
self.ticket = os.environ.get("BOHR_TICKET", "") |
|
header["Authorization"] = f"jwt {self.token}" |
|
header["Brm-Ticket"] = self.ticket |
|
def refresh_token(self, retry=3): |
|
self.ticket = os.environ.get("BOHR_TICKET", "") |
|
if self.ticket: |
|
return |
|
url = "/account/login" |
|
post_data = {"email": self.config["email"], "password": self.config["password"]} |
|
def get_log(self, job_id): |
|
url, size = self._get_job_log(job_id) |
|
if not url: |
|
return "" |
|
if self.last_log_offset >= size: |
|
return "" |
|
resp = requests.get(url, headers={"Range": f"bytes={self.last_log_offset}-"}) |
|
self.last_log_offset += len(resp.content) |
Impact
Client(ticket="...") is ignored unless BOHR_TICKET is also set, causing unexpected password-login attempts. When polling logs for multiple jobs, reading job A advances the single offset and can skip job B's logs.
Suggested fix
Preserve an explicit constructor ticket unless a non-empty environment override is intentionally provided. Track log offsets per job id, for example dict[str, int] keyed by job_id.
Found by a Codex global repository scan of deepmodeling/dpdispatcher at commit 98a9e08.
Problem
The cloud client overwrites an explicit constructor ticket from
BOHR_TICKETon every request/refresh, and it tracks log download offset in one shared integer across all jobs.Relevant code
dpdispatcher/dpdispatcher/utils/dpcloudserver/client.py
Lines 39 to 40 in 98a9e08
dpdispatcher/dpdispatcher/utils/dpcloudserver/client.py
Lines 55 to 59 in 98a9e08
dpdispatcher/dpdispatcher/utils/dpcloudserver/client.py
Lines 108 to 113 in 98a9e08
dpdispatcher/dpdispatcher/utils/dpcloudserver/client.py
Lines 273 to 280 in 98a9e08
Impact
Client(ticket="...")is ignored unlessBOHR_TICKETis also set, causing unexpected password-login attempts. When polling logs for multiple jobs, reading job A advances the single offset and can skip job B's logs.Suggested fix
Preserve an explicit constructor ticket unless a non-empty environment override is intentionally provided. Track log offsets per job id, for example
dict[str, int]keyed byjob_id.