def _extract_java_data(self): """Extracts Java node data.""" root = self.oozie_node props = self.props if "mapred.child.java.opts" in props.merged: self.java_opts.extend( props.merged["mapred.child.java.opts"].split(" ")) if "mapreduce.map.java.opts" in props.merged: self.java_opts.extend( props.merged["mapreduce.map.java.opts"].split(" ")) self.main_class = xml_utils.get_tag_el_text(root=root, tag=TAG_MAIN_CLASS, props=props) java_opts_string = xml_utils.get_tag_el_text(root=root, tag=TAG_JAVA_OPTS, props=props) if java_opts_string: self.java_opts.extend(java_opts_string.split(" ")) else: self.java_opts.extend( get_tags_el_array_from_text(root=root, tag=TAG_JAVA_OPT, props=props)) self.args = get_tags_el_array_from_text(root=root, tag=TAG_ARG, props=props)
def get_command(self) -> str: cmd_txt = xml_utils.get_tag_el_text(self.oozie_node, TAG_CMD, self.props) args = xml_utils.get_tags_el_array_from_text(self.oozie_node, TAG_ARG, self.props) if not cmd_txt: raise Exception("Missing or empty command node in SSH action {}".format(self.oozie_node)) cmd = " ".join([cmd_txt] + [shlex.quote(x) for x in args]) cmd = el_utils.convert_el_to_jinja(cmd) return cmd
def get_command(self) -> str: cmd_txt = xml_utils.get_tag_el_text(self.oozie_node, TAG_CMD) args = xml_utils.get_tags_el_array_from_text(self.oozie_node, TAG_ARG) if not cmd_txt: raise Exception(f"Missing or empty command node in SSH action {self.oozie_node}") cmd = " ".join([cmd_txt] + [shlex.quote(x) for x in args]) cmd = el_parser.translate(cmd, quote=True) return cmd
def _parse_oozie_node(self): self.resource_manager = get_tag_el_text(self.oozie_node, TAG_RESOURCE) self.name_node = get_tag_el_text(self.oozie_node, TAG_NAME) cmd_txt = get_tag_el_text(self.oozie_node, TAG_CMD) args = get_tags_el_array_from_text(self.oozie_node, TAG_ARG) cmd = " ".join([cmd_txt] + [x for x in args]) self.bash_command = el_parser.translate(cmd, quote=False) self.pig_command = f"sh {self.bash_command}"
def _parse_oozie_node(self): self.resource_manager = get_tag_el_text(self.oozie_node, TAG_RESOURCE, self.props) self.name_node = get_tag_el_text(self.oozie_node, TAG_NAME, self.props) cmd_txt = get_tag_el_text(self.oozie_node, TAG_CMD, self.props) args = get_tags_el_array_from_text(self.oozie_node, TAG_ARG, self.props) cmd = " ".join([cmd_txt] + [x for x in args]) self.bash_command = convert_el_to_jinja(cmd, quote=False) self.pig_command = f"sh {self.bash_command}"
def on_parse_node(self): super().on_parse_node() _, self.hdfs_files = self.file_extractor.parse_node() _, self.hdfs_archives = self.archive_extractor.parse_node() self.java_jar = get_tag_el_text(self.oozie_node, tag=SPARK_TAG_JAR) self.java_class = get_tag_el_text(self.oozie_node, tag=SPARK_TAG_CLASS) if self.java_class and self.java_jar: self.dataproc_jars = [self.java_jar] self.java_jar = None self.job_name = get_tag_el_text(self.oozie_node, tag=SPARK_TAG_JOB_NAME) spark_opts = xml_utils.find_nodes_by_tag(self.oozie_node, SPARK_TAG_OPTS) if spark_opts: self.spark_opts.update(self._parse_spark_opts(spark_opts[0])) self.application_args = xml_utils.get_tags_el_array_from_text(self.oozie_node, tag=SPARK_TAG_ARG)