@@ -191,16 +191,23 @@ def unlock_safe(names: List[str], owner: str, run_name: str = "", job_id: str =
191191def unlock_one_safe (name : str , owner : str , run_name : str = "" , job_id : str = "" ) -> bool :
192192 node_status = query .get_status (name )
193193 if node_status .get ("locked" , False ) is False :
194- log .warn (f"Refusing to unlock { name } since it is already unlocked" )
194+ log .info (f"Refusing to unlock { name } since it is already unlocked" )
195195 return False
196196 maybe_job = query .node_active_job (name , node_status )
197197 if not maybe_job :
198198 return unlock_one (name , owner , node_status ["description" ], node_status )
199- if run_name and job_id and maybe_job .endswith (f"{ run_name } /{ job_id } " ):
200- log .error (f"Refusing to unlock { name } since it has an active job: { run_name } /{ job_id } " )
199+ if run_name :
200+ if job_id and not maybe_job .endswith (f"{ run_name } /{ job_id } " ):
201+ log .info ("Not unlocking {name} since it is running {maybe_job}, not {run_name}/{job_id}" )
201202 return False
202- log .warning (f"Refusing to unlock { name } since it has an active job: { maybe_job } " )
203- return False
203+ elif not job_id and not maybe_job .endswith (run_name ):
204+ log .info (f"Not unlocking { name } since it is running { maybe_job } , not { run_name } " )
205+ return False
206+ else :
207+ return unlock_one (name , owner , node_status ["description" ], node_status )
208+ else :
209+ log .info (f"Refusing to unlock { name } since it has an active job: { maybe_job } " )
210+ return False
204211
205212
206213def unlock_many (names , user ):
0 commit comments