'Construct the spark-submit command to execute.
:param application: command to append to the spark-submit command
:type application: str
:return: full command to be executed'

def _build_command(self, application):

    if self._connection['spark_home']:
        connection_cmd = [os.path.join(self._connection['spark_home'], 'bin', self._connection['spark_binary'])]
    else:
        connection_cmd = [self._connection['spark_binary']]
    connection_cmd += ['--master', self._connection['master']]
    if self._conf:
        for key in self._conf:
            connection_cmd += ['--conf', '{}={}'.format(key, str(self._conf[key]))]
    if self._files:
        connection_cmd += ['--files', self._files]
    if self._py_files:
        connection_cmd += ['--py-files', self._py_files]
    if self._jars:
        connection_cmd += ['--jars', self._jars]
    if self._num_executors:
        connection_cmd += ['--num-executors', str(self._num_executors)]
    if self._total_executor_cores:
        connection_cmd += ['--total-executor-cores', str(self._total_executor_cores)]
    if self._executor_cores:
        connection_cmd += ['--executor-cores', str(self._executor_cores)]
    if self._executor_memory:
        connection_cmd += ['--executor-memory', self._executor_memory]
    if self._driver_memory:
        connection_cmd += ['--driver-memory', self._driver_memory]
    if self._keytab:
        connection_cmd += ['--keytab', self._keytab]
    if self._principal:
        connection_cmd += ['--principal', self._principal]
    if self._name:
        connection_cmd += ['--name', self._name]
    if self._java_class:
        connection_cmd += ['--class', self._java_class]
    if self._verbose:
        connection_cmd += ['--verbose']
    if self._connection['queue']:
        connection_cmd += ['--queue', self._connection['queue']]
    if self._connection['deploy_mode']:
        connection_cmd += ['--deploy-mode', self._connection['deploy_mode']]
    connection_cmd += [application]
    if self._application_args:
        connection_cmd += self._application_args
    logging.debug('Spark-Submit    cmd:    {}'.format(connection_cmd))
    return connection_cmd
