def cmd_args()

in pygenie/jobs/hadoop.py [0:0]


    def cmd_args(self):
        """
        The constructed command line arguments using the job's definition. If the
        command line arguments are set explicitly (by calling
        :py:meth:`command_arguments`) this will be the same.
        """

        if self._command_arguments is not None:
            return self._command_arguments

        props_str = ' '.join([
            '-D{name}={value}'.format(name=k, value=v) \
            for k, v in self._command_options.get('-D', {}).items()
        ])

        prop_file_str = '-conf {}'.format(os.path.basename(self._property_file)) \
            if self._property_file \
            else ''

        cmd_split = self._script.split(' -', 1) if self._script is not None else ['']

        return '{command} {prop_file} {props} {command_options} {post_cmd_args}' \
            .format(prop_file=prop_file_str,
                    props=props_str,
                    command=cmd_split[0],
                    command_options='-{}'.format(cmd_split[1]) if len(cmd_split) > 1 else '',
                    post_cmd_args=' '.join(self._post_cmd_args)) \
            .strip()