This function will be automatically run from main.py and triggers the following functions:
        - on_unit_created
        - on_unit_destroyed
        - on_building_construction_complete
490176
async def issue_events(self):
        
        await self._issue_unit_dead_events()
        await self._issue_unit_added_events()
        for unit in self.units.structure:
            await self._issue_building_complete_event(unit)
271515
function start() {
    proc = spawn(procCommand, procArgs, procOptions);

    var onClose = function (code) {
      if (!restarting) {
        process.exit(code);
      }
      start();
      restarting = false;
    };

    proc.on('error', function () {
      debug('restarting due error');
      restarting = true;
      proc.kill('SIGINT');
    });

    proc.on('close', onClose);
  }
849235
def start(self):
        '''
        
        '''
        # invoke the appropriate sub-command as requested from command-line
        try:
            self.args.func()
        except SystemExit as e:
            if e.code != 0:
                raise
        except KeyboardInterrupt:
            self.log.warning("exited via keyboard interrupt")
        except:
            self.log.exception("exited start function")
            # set exit code so we know it did not end successfully
            # TODO different exit codes based on signals ?
        finally:
            self._flush_metrics_q.put(None, block=True)
            self._flush_metrics_q.put(None, block=True, timeout=1)

        self.log.debug("exited_successfully")
274042
def run(self):
        
        self.call_plugins("on_run")
        if vars(self.arguments).get("version", None):
            self.logger.info("{app_name}: {version}".format(app_name=self.app_name, version=self.version))
        else:
            if self.arguments.command == "main":
                self.main()
            else:
                self.subcommands[self.arguments.command].run()
        self.call_plugins("on_end")
1347136
def main(arguments=None):   # suppress(unused-function)
    """"""
    result = _parse_arguments(arguments)
    linter_funcs = _ordered(linter_functions_from_filters,
                            result.whitelist,
                            result.blacklist)
    global_options = vars(result)
    tool_options = tool_options_from_global(global_options, len(result.files))
    any_would_run = _any_would_run(_run_lint_on_file_exceptions,
                                   result.files,
                                   result.stamp_file_path,
                                   result.log_technical_terms_to,
                                   linter_funcs,
                                   tool_options,
                                   result.fix_what_you_can)

    if any_would_run:
        for linter_function in linter_funcs.values():
            if linter_function.before_all:
                linter_function.before_all(global_options, tool_options)

        use_multiprocessing = _should_use_multiprocessing(len(result.files))
    else:
        use_multiprocessing = False

    if use_multiprocessing:
        mapper = parmap.map
    else:
        # suppress(E731)
        mapper = lambda f, i, *a: [f(*((x, ) + a)) for x in i]

    errors = list(itertools.chain(*mapper(_run_lint_on_file_stamped,
                                          result.files,
                                          result.stamp_file_path,
                                          result.log_technical_terms_to,
                                          linter_funcs,
                                          tool_options,
                                          result.fix_what_you_can)))

    for error in sorted(errors):
        _report_lint_error(error.failure, os.path.relpath(error.absolute_path))

    if any_would_run:
        for linter_funcs in linter_funcs.values():
            if linter_funcs.after_all:
                linter_funcs.after_all(global_options, tool_options)

    return len(errors)
59596
def main():
    
    args = parse_args()
    logging.basicConfig(level=LOG_LEVELS[min(
        args.verbosity, len(LOG_LEVELS) - 1)])

    loop = asyncio.get_event_loop()
    loop.run_until_complete(_run(args))
166518
def run(self):
        
        with open('src/lsqfit/__init__.py', 'a') as lsfile:
            lsfile.write("\n__version__ = '%s'\n" % LSQFIT_VERSION)
        _build_py.run(self)
1217124
def run(self):
        
        luigi.LocalTarget(path=self.fixture).copy(self.output().path)
1007835
def run(self):
        

        init_folder = os.getcwd()
        os.chdir(self.folder)

        with zopen(self.log_file, 'w') as fout:
            subprocess.call([self._NWCHEM2FIESTA_cmd, self._nwcheminput_fn,
                             self._nwchemoutput_fn, self._nwchemmovecs_fn],
                            stdout=fout)

        os.chdir(init_folder)
897264
def _try_run(self, run_func: Callable[[], None]) -> None:
        
        # Initialization: before_training
        for hook in self._hooks:
            hook.before_training()

        try:
            run_func()
        except TrainingTerminated as ex:
            logging.info('Training terminated: %s', ex)

        # After training: after_training
        for hook in self._hooks:
            hook.after_training()
508378
def create(self):
        
        self._app = Flask(__name__)

        path = '/2015-03-31/functions/<function_name>/invocations'
        self._app.add_url_rule(path,
                               endpoint=path,
                               view_func=self._invoke_request_handler,
                               methods=['POST'],
                               provide_automatic_options=False)

        # setup request validation before Flask calls the view_func
        self._app.before_request(LocalLambdaInvokeService.validate_request)

        self._construct_error_handling()
361110
def run(**kwargs):
    
    from sampleproject.app import app

    app.update_settings(**kwargs)
    app.run()
545419
def onStart(self, *args, **kwarg):
        
        with transactUI(self):
            config = self.navbar.getActiveConfig()
            config.resetErrors()
            if config.isValid():
                self.clientRunner.run(self.buildCliString())
                self.showConsole()
            else:
                config.displayErrors()
                self.Layout()
111141
public function run()
    {
        //Update process state.
        self::$_status = self::STATUS_RUNNING;

        // Register shutdown function for checking errors.
        register_shutdown_function(array("\\Workerman\\Worker", 'checkErrors'));

        // Set autoload root path.
        Autoloader::setRootPath($this->_autoloadRootPath);
        // Create a global event loop.
        if (!self::$globalEvent) {
            $event_loop_class = self::getEventLoopName();
            self::$globalEvent = new $event_loop_class;
            // Register a listener to be notified when server socket is ready to read.
            if ($this->_socketName) {
                if ($this->transport !== 'udp') {
                    self::$globalEvent->add($this->_mainSocket, EventInterface::EV_READ,
                        array($this, 'acceptConnection'));
                } else {
                    self::$globalEvent->add($this->_mainSocket, EventInterface::EV_READ,
                        array($this, 'acceptUdpConnection'));
                }
            }
        }


        // Reinstall signal.
        self::reinstallSignal();

        // Init Timer.
        Timer::init();

        // Try to emit onWorkerStart callback.
        if ($this->onWorkerStart) {
            try {
                call_user_func($this->onWorkerStart, $this);
            } catch (\Exception $e) {
                self::log($e);
                // Avoid rapid infinite loop exit.
                sleep(1);
                exit(250);
            } catch (\Error $e) {
                self::log($e);
                // Avoid rapid infinite loop exit.
                sleep(1);
                exit(250);
            }
        }


        // Main loop.
        self::$globalEvent->loop();
    }
35319
def run(self):
        """"""
        print('---- BUILDING ----')
        _build.run(self)

        # build documentation
        print('---- BUILDING DOCS ----')
        docdir = os.path.join(self.build_lib, 'pyshtools', 'doc')
        self.mkpath(docdir)
        doc_builder = os.path.join(self.build_lib, 'pyshtools', 'make_docs.py')
        doc_source = '.'
        check_call([sys.executable, doc_builder, doc_source, self.build_lib])

        print('---- ALL DONE ----')
443447
def run(self):
    """"""

    if not (self._watchman and self._watchman.is_alive()):
      raise PantsService.ServiceError('watchman is not running, bailing!')

    # Enable watchman for the build root.
    self._watchman.watch_project(self._build_root)

    subscriptions = list(self._handlers.values())

    # Setup subscriptions and begin the main event firing loop.
    for handler_name, event_data in self._watchman.subscribed(self._build_root, subscriptions):
      self._state.maybe_pause()
      if self._state.is_terminating:
        break

      if event_data:
        # As we receive events from watchman, trigger the relevant handlers.
        self.fire_callback(handler_name, event_data)
423056
async def start_child():
    

    logger.info('Started to watch for code changes')

    loop = asyncio.get_event_loop()
    watcher = aionotify.Watcher()

    flags = (
        aionotify.Flags.MODIFY |
        aionotify.Flags.DELETE |
        aionotify.Flags.ATTRIB |
        aionotify.Flags.MOVED_TO |
        aionotify.Flags.MOVED_FROM |
        aionotify.Flags.CREATE |
        aionotify.Flags.DELETE_SELF |
        aionotify.Flags.MOVE_SELF
    )

    watched_dirs = list_dirs()

    for dir_name in watched_dirs:
        watcher.watch(path=dir_name, flags=flags)

    await watcher.setup(loop)

    while True:
        evt = await watcher.get_event()
        file_path = path.join(evt.alias, evt.name)

        if file_path in watched_dirs or file_path.endswith('.py'):
            await asyncio.sleep(settings.CODE_RELOAD_DEBOUNCE)
            break

    watcher.close()
    exit_for_reload()