def configure(self, config): if "dvid" in config: self._dvid_env = dvidenv.DvidEnv() self._dvid_env.load_server_config(config["dvid"]) self._body_id = config.get("bodyid") self._force_update = config.get("force_update", False) self._output = config.get("output", None)
def skeletonize(self, bodyId, bg = False, forceUpdate = False): if bodyId < 1: raise Exception("Invalid body ID") if self.dvidEnv and self.dvidEnv.is_valid(): neutuInput = self.dvidEnv.get_neutu_input() print(neutuInput) args = [self.executable, "--command", "--skeletonize", "--bodyid", str(bodyId), neutuInput] if forceUpdate: args.append("--force") print(args) p = subprocess.Popen(args) if not bg: p.wait() return p else: raise Exception("Invalid DVID env") if __name__ == "__main__": skeletonizer = Skeletonizer() dvidEnv = dvidenv.DvidEnv(host = "emdata1.int.janelia.org", port = 8500, uuid = "b6bc", labelvol="bodies") skeletonizer.setDvidEnv(dvidEnv) skeletonizer.setExecutable("/Users/zhaot/Work/neutube/neurolabi/neuTube_Debug_FlyEM_Qt5/neutu_d.app/Contents/MacOS/neutu_d") #conn.request("DELETE", dvidUrl.getSkeletonEndPoint(15363212)) skeletonizer.skeletonize(13054149, bg = False, forceUpdate = True) print("Done")
def __init__(self, host=None, port=None, uuid=None, env=None): if env: self._url = dvidenv.DvidUrl(env) else: self._url = dvidenv.DvidUrl( dvidenv.DvidEnv(host=host, port=port, uuid=uuid))
def load_server(self, config): env = dvidenv.DvidEnv(host = config.get('host', None), port = config.get('port', None), uuid = config.get('uuid', None)) self._url = dvidenv.DvidUrl(env)
print(self._neutu) du = self._url task_url = du.get_url(du.get_split_task_path(task_key)) print(task_url) commandConfig = {"command": "split_body", "commit": self._commit} # '{"command": "split_body"}' args = [self._neutu, '--command', '--general', json.dumps(commandConfig), task_url, '-o', du.get_node_url()] print(args) p = subprocess.Popen(args) p.wait() return p if __name__ == '__main__': bs = BodySplit('/Users/zhaot/Work/neutube/neurolabi/neuTube_Debug_FlyEM_Qt5/neutu_d.app/Contents/MacOS/neutu_d') bs.set_server(dvidenv.DvidEnv("zhaot-ws1", 9000, "194d")) bs.set_committing(True) bs.run("task__http-++emdata1.int.janelia.org-8500+api+node+b6bc+bodies+sparsevol+12767166") # print(bs.get_split_task_url()) # # dc = dvidio.DvidClient(env = bs.get_env()) # print(dc.is_split_result_processed(key = "task__http-++emdata1.int.janelia.org-8500+api+node+b6bc+bodies+sparsevol+12767166")) # # bs.clear_split_task() # bs.clear_split_result()
if self._type == DataEvent.DATA_INVALIDATE: s += "Invalidate" elif self._type == DataEvent.DATA_UPDATE: s += "Update" elif self._type == DataEvent.DATA_DELETE: s += "Delete" s += "|" + self.getDataId().getId() return s def getType(self): return self._type def getDataId(self): return self.dataId class DataValidator: def __init__(self, dvidEnv): self.dvidEnv = dvidEnv def setDvidEnv(self, dvidEnv): self.dvidEnv = dvidEnv if __name__ == "__main__": event = DataEvent(DataEvent.DATA_INVALIDATE, DataId(DataId.DATA_BODY, 1), dvidenv.DvidEnv("emdata1.int.janelia.org", 8500, "372c")) print(event)