Beispiel #1
0
 def _configure_app_loggers(self):
     make_dir(LogSettings.APPS_DIRECTORY)
     apps = App.get_app()
     for app in apps:
         if not app in self._app_loggers:
             logger = self._make_app_logger(app.name)
             self._app_loggers[app.name] = logger 
Beispiel #2
0
 def get(self, organization, repo):
     super(GithubStatusHandler, self).get()
     app_name = self._make_app_name(organization, repo)
     app = App.get_app(app_name)
     if not app:
         self.set_status(404)
         self.write({"error": "app does not exist"})
     else:
         self._write_build_state(app)
Beispiel #3
0
 def get(self, organization, repo):
     super(GithubStatusHandler, self).get()
     app_name = self._make_app_name(organization, repo)
     app = App.get_app(app_name)
     if not app:
         self.set_status(404)
         self.write({"error": "app does not exist"})
     else:
         self._write_build_state(app)
Beispiel #4
0
 def get(self, organization, repo):
     # if the app is still building, return an error. If the app is built, deploy it and return
     # the redirect url
     super(GithubHandler, self).get()
     app_name = self._make_app_name(organization, repo)
     app = App.get_app(app_name)
     if app and app.build_state == App.BuildState.COMPLETED:
         redirect_url = app.deploy("single-node")
         self.write({"redirect_url": redirect_url})
     else:
         self.set_status(404)
         self.write({"error": "no app available to deploy"})
Beispiel #5
0
 def run(self):
     app = App.get_app(self._app_name)
     time_string = datetime.datetime.strftime(app.last_build_time, LogSettings.TIME_FORMAT)
     self._stream = AppLogStreamer(self._app_name, time_string).get_stream()
     while not self._stopped:
         time.sleep(0.05)
         try: 
             msg = self._stream.next()
             if msg:
                 self._ioloop.add_callback(self._handler.write_message, msg)
         except StopIteration:
             self.stop()
Beispiel #6
0
 def get(self, organization, repo):
     # if the app is still building, return an error. If the app is built, deploy it and return
     # the redirect url
     super(GithubHandler, self).get()
     app_name = self._make_app_name(organization, repo)
     app = App.get_app(app_name)
     if app and app.build_state == App.BuildState.COMPLETED:
         redirect_url = app.deploy("single-node")
         self.write({"redirect_url": redirect_url})
     else:
         self.set_status(404)
         self.write({"error": "no app available to deploy"})
Beispiel #7
0
def build_app(spec, log_dir, preload=False):
    name = spec["name"]
    app = App.get_app(name)
    if app and app.build_state == App.BuildState.BUILDING:
        print("App {} already building. Wait for build to complete before resubmitting.".format(name))
        return
    new_app = App.create(spec)
    try:
        new_app.build(preload=preload)
    except Exception as e:
        # the "catch-all" clause
        print("Could not build app {}: {}".format(new_app.name, e))
        App.index.update_build_state(App.BuildState.FAILED)
Beispiel #8
0
def build_app(spec, log_dir, preload=False):
    name = spec["name"]
    app = App.get_app(name)
    if app and app.build_state == App.BuildState.BUILDING:
        print("App {} already building. Wait for build to complete before resubmitting.".format(name))
        return
    new_app = App.create(spec)
    try:
        new_app.build(preload=preload)
    except Exception as e:
        # the "catch-all" clause
        print("Could not build app {}: {}".format(new_app.name, e))
        App.index.update_build_state(App.BuildState.FAILED)
Beispiel #9
0
 def run(self):
     app = App.get_app(self._app_name)
     time_string = datetime.datetime.strftime(app.last_build_time,
                                              LogSettings.TIME_FORMAT)
     self._stream = AppLogStreamer(self._app_name,
                                   time_string).get_stream()
     while not self._stopped:
         time.sleep(0.05)
         try:
             msg = self._stream.next()
             if msg:
                 self._ioloop.add_callback(self._handler.write_message,
                                           msg)
         except StopIteration:
             self.stop()
Beispiel #10
0
def build_app(spec, log_dir, preload=False):
    name = spec["name"]
    sys.stdout = open(os.path.join(log_dir, name + "-" + str(os.getpid()) + ".out"), "w", buffering=0)
    sys.stderr = open(os.path.join(log_dir, name + "-" + str(os.getpid()) + ".err"), "w", buffering=0)
    app = App.get_app(name)
    print("In build_app")
    if app and app.build_state == App.BuildState.BUILDING:
        print("App {} already building. Wait for build to complete before resubmitting.".format(name))
        return
    new_app = App.create(spec)
    try:
        new_app.build(preload=preload)
    except Exception as e:
        # the "catch-all" clause
        print("Could not build app {}: {}".format(new_app.name, e))
        App.index.update_build_state(App.BuildState.FAILED)
Beispiel #11
0
def build_app(spec, log_dir, preload=False):
    name = spec["name"]
    sys.stdout = open(os.path.join(log_dir,
                                   name + "-" + str(os.getpid()) + ".out"),
                      "w",
                      buffering=0)
    sys.stderr = open(os.path.join(log_dir,
                                   name + "-" + str(os.getpid()) + ".err"),
                      "w",
                      buffering=0)
    app = App.get_app(name)
    print("In build_app")
    if app and app.build_state == App.BuildState.BUILDING:
        print(
            "App {} already building. Wait for build to complete before resubmitting."
            .format(name))
        return
    new_app = App.create(spec)
    try:
        new_app.build(preload=preload)
    except Exception as e:
        # the "catch-all" clause
        print("Could not build app {}: {}".format(new_app.name, e))
        App.index.update_build_state(App.BuildState.FAILED)
Beispiel #12
0
 def _configure_app_loggers(self):
     make_dir(LogSettings.APPS_DIRECTORY)
     apps = App.get_app()
     for app in apps:
         if not app.name in self._app_loggers:
             self._make_app_loggers(app.name)
Beispiel #13
0
 def _get_apps(self):
     return App.get_app()
Beispiel #14
0
 def get(self):
     super(AppsHandler, self).get()
     apps = App.get_app()
     self.write({"apps": [app.name for app in apps]})
Beispiel #15
0
 def _get_app(self, app_name):
     return App.get_app(app_name)
Beispiel #16
0
 def _get_app(self, app_name):
     return App.get_app(app_name)
Beispiel #17
0
 def _get_apps(self):
     return App.get_app()
Beispiel #18
0
 def get(self):
     super(AppsHandler, self).get()
     apps = App.get_app()
     self.write({"apps": [app.name for app in apps]})