def compute(self, verbose: bool = False, lineage: bool = False) -> \ Union[float, np.array, Tuple[Union[float, np.array], str]]: if self._result_var is None or self._lineage_trace is None: self._script = DMLScript(self.sds_context) self._script.build_code(self) if verbose: print("SCRIPT:") print(self._script.dml_script) if lineage: result_variables, self._lineage_trace = self._script.execute_with_lineage() else: result_variables = self._script.execute() if result_variables is not None: self._result_var = self._parse_output_result_variables( result_variables) if verbose: for x in self.sds_context.get_stdout(): print(x) for y in self.sds_context.get_stderr(): print(y) self._script.clear(self) if lineage: return self._result_var, self._lineage_trace else: return self._result_var
def compute(self, verbose: bool = False, lineage: bool = False) -> \ Union[float, np.array, Tuple[Union[float, np.array], str]]: if self._result_var is None or self._lineage_trace is None: self._script = DMLScript(self.sds_context) self._script.build_code(self) if lineage: result_variables, self._lineage_trace = self._script.execute( lineage) else: result_variables = self._script.execute(lineage) if self.output_type == OutputType.DOUBLE: self._result_var = result_variables.getDouble( self._script.out_var_name) elif self.output_type == OutputType.MATRIX: self._result_var = matrix_block_to_numpy( self.sds_context.java_gateway.jvm, result_variables.getMatrixBlock(self._script.out_var_name)) if verbose: print(self._script.dml_script) # TODO further info if lineage: return self._result_var, self._lineage_trace else: return self._result_var
def get_lineage_trace(self) -> str: """Get the lineage trace for this node. :return: Lineage trace """ if self._lineage_trace is None: self._script = DMLScript(self.sds_context) self._script.build_code(self) self._lineage_trace = self._script.get_lineage() return self._lineage_trace
def getLineageTrace(self) -> str: """Get the lineage trace for this node. :return: Lineage trace """ if self.lineage_trace is None: self.script = DMLScript() self.script.build_code(self) self.lineage_trace = self.script.getlineage() return self.lineage_trace
def compute(self, verbose: bool = False, lineage: bool = False) -> \ Union[float, np.array, Tuple[Union[float, np.array], str]]: if self._result_var is None or self._lineage_trace is None: self._script = DMLScript(self.sds_context) self._script.build_code(self) if verbose: print("SCRIPT:") print(self._script.dml_script) if lineage: result_variables, self._lineage_trace = self._script.execute( lineage) else: result_variables = self._script.execute(lineage) if self.output_type == OutputType.DOUBLE: self._result_var = result_variables.getDouble( self._script.out_var_name[0]) elif self.output_type == OutputType.MATRIX: self._result_var = matrix_block_to_numpy( self.sds_context.java_gateway.jvm, result_variables.getMatrixBlock( self._script.out_var_name[0])) elif self.output_type == OutputType.LIST: self._result_var = [] for idx, v in enumerate(self._script.out_var_name): if (self._output_types == None): self._result_var.append( matrix_block_to_numpy( self.sds_context.java_gateway.jvm, result_variables.getMatrixBlock(v))) elif (self._output_types[idx] == OutputType.MATRIX): self._result_var.append( matrix_block_to_numpy( self.sds_context.java_gateway.jvm, result_variables.getMatrixBlock(v))) else: self._result_var.append( result_variables.getDouble( self._script.out_var_name[idx])) if verbose: for x in self.sds_context.get_stdout(): print(x) for y in self.sds_context.get_stderr(): print(y) if lineage: return self._result_var, self._lineage_trace else: return self._result_var