def _to_java_ir(self, ir): if not hasattr(ir, '_jir'): r = Renderer(stop_at_jir=True) code = r(ir) # FIXME parse should be static ir._jir = ir.parse(code, ir_map=r.jirs) return ir._jir
def interpret(self, ir): assert isinstance(ir, hail.ir.IR) r = Renderer(stop_at_jir=True) code = r(ir) ir_map = {name: jir for name, jir in r.jirs.items()} jir = ir.to_java_ir() typ = HailType._from_java(jir.typ()) result = Env.hail().expr.ir.Interpret.interpretPyIR(code, {}, ir_map) return typ._from_json(result)
def execute(self, ir): r = Renderer(stop_at_jir=True) code = r(ir) assert len(r.jirs) == 0 resp = requests.post(f'http://hail-apiserver:5000/execute', json=code) resp.raise_for_status() resp_json = resp.json() typ = dtype(resp_json['type']) result = resp_json['value'] return typ._from_json(result)
def _render(self, ir): r = Renderer() assert len(r.jirs) == 0 return r(ir)