Main function to executes from cmd. Emulates django-admin.py execution.
    :param kwargs: overrided env-settings
    :rtype: None
550956
def cmd_execution(*args, **kwargs):
    # pylint: disable=unused-variable
    '''
    
    '''
    from django.core.management import execute_from_command_line
    prepare_environment(**kwargs)
    args = list(sys.argv)
    args[0] = os.getenv("VST_CTL_SCRIPT", sys.argv[0])
    execute_from_command_line(args or sys.argv)
59566
def _execute_cmd(plugin, args='', run_type='cmd.retcode'):
    '''
    
    '''
    data = {}

    all_plugins = list_plugins()
    if plugin in all_plugins:
        data = __salt__[run_type](
                '{0}{1} {2}'.format(PLUGINDIR, plugin, args),
                python_shell=False)

    return data
1119163
def execute(self, env, args):
        

        tasks = env.task.get_list_info()
        if not tasks:
            env.io.write("No tasks found.")

        else:
            if args.verbose:
                _print_tasks(env, tasks, mark_active=True)

            else:
                if env.task.active:
                    active_task = env.task.name
                else:
                    active_task = None

                for task, options, blocks in tasks:
                    if task == active_task:
                        env.io.success(task + ' *')
                    else:
                        if options is None and blocks is None:
                            env.io.error(task + ' ~')
                        else:
                            env.io.write(task)
1342534
def management_command(self, command, *args, **kwargs):
        
        self.setup_django()
        if 'verbosity' not in kwargs:
            kwargs['verbosity'] = self.verbosity
        if not self.use_colour:
            kwargs['no_color'] = False
        self.debug(self.yellow_style('$ manage.py %s' % command))
        return call_command(command, *args, **kwargs)
88264
def run_direct(self, **kwargs):
        
        for key in kwargs:
            setattr(self, key, kwargs[key])
        self.command = self.COMMAND_RUN_DIRECT
1325952
def exec_python_rc(*args, **kwargs):
    
    cmdargs, kwargs = __wrap_python(args, kwargs)
    return exec_command_rc(*cmdargs, **kwargs)
1098447
def subprocess(cls, cmd, **kwargs):
    
    def call(args):
      return subprocess.call(cmd + args, **kwargs)
    return cls(call)
41181
def execute(self, args):
    
    all_args = list(args)
    try:
      return self._cmd(all_args)
    except OSError as e:
      if errno.E2BIG == e.errno:
        args1, args2 = self._split_args(all_args)
        result = self.execute(args1)
        if result != 0:
          return result
        return self.execute(args2)
      else:
        raise e
210062
def env(*args, **kwargs):
    
    for arg in args:
        value = os.environ.get(arg, None)
        if value:
            return value
    return kwargs.get("default", "")
1345705
def run_from_command_line():
    
    for commands_conf in firenado.conf.management['commands']:
        logger.debug("Loading %s commands from %s." % (
            commands_conf['name'],
            commands_conf['module']
        ))
        exec('import %s' % commands_conf['module'])
    command_index = 1
    for arg in sys.argv[1:]:
        command_index += 1
        if arg[0] != "-":
            break
    parser = FirenadoArgumentParser(prog=os.path.split(sys.argv[0])[1],
                                    add_help=False)
    parser.add_argument("-h", "--help", default=argparse.SUPPRESS)
    parser.add_argument("command", default="help", help="Command to executed")

    try:
        namespace = parser.parse_args(sys.argv[1:command_index])
        if not command_exists(namespace.command):
            show_command_line_usage(parser)
        else:
            run_command(namespace.command, sys.argv[command_index-1:])
    except FirenadoArgumentError:
        show_command_line_usage(parser, True)
432825
def run(self, **kwargs):
        
        for key in kwargs:
            setattr(self, key, kwargs[key])
        self.command = self.COMMAND_RUN
956049
def execute(self):
        
        self.autocomplete()
        if len(self.argv):
            cmd = self.argv[0]
            cmd_argv = self.get_argv_for_command()
            self.run_command(cmd, cmd_argv)
        else:
            self.show_help()
324329
def _execute(self, *args: str, **kwargs: Any) -> tuple:
        ''''''
        return self.execute(args=args, options=merge_dict(self.options, kwargs)).communicate()
1302858
def handle(self, *args, **opt):
        
        d1_gmn.app.management.commands.util.util.log_setup(opt["debug"])
        logging.info(
            "Running management command: {}".format(
                __name__
            )  # util.get_command_name())
        )
        d1_gmn.app.management.commands.util.util.exit_if_other_instance_is_running(
            __name__
        )
        self._opt = opt
        try:
            # profiler = profile.Profile()
            # profiler.runcall(self._handle)
            # profiler.print_stats()
            self._handle()
        except d1_common.types.exceptions.DataONEException as e:
            logging.error(str(e))
            raise django.core.management.base.CommandError(str(e))
        self._events.dump_to_log()
545995
def run(cmds, **kwargs):
    
    proc = sp.Popen(cmds, bufsize=-1, stdout=sp.PIPE, stderr=sp.STDOUT,
                    close_fds=sys.platform != 'win32')
    for line in proc.stdout:
        print(line[:-1].decode())
    retcode = proc.wait()
    if retcode:
        raise sp.CalledProcessError(retcode, cmds)
616756
def main(args=None):
    
    cfg.configureLogger()
    wireHandlers(cfg)
    # get config from a flask standard place not our config yml
    app.run(debug=cfg.runInDebug(), host='0.0.0.0', port=cfg.getPort())
1158538
def executescript(self, *args, **kwargs):
        

        with self:
            self._cursor.executescript(*args, **kwargs)