Example #1
0
 def get(self, organization, repo):
     super(StaticLogsHandler, self).get()
     app_name = App.make_app_name(organization, repo)
     app = yield self._get_app(app_name)
     time_string = datetime.datetime.strftime(app.last_build_time, LogSettings.TIME_FORMAT)
     logs = yield self._get_app_logs(app_name, time_string)
     self.write({"logs": logs})
Example #2
0
 def get(self, organization, repo):
     super(StaticLogsHandler, self).get()
     app_name = App.make_app_name(organization, repo)
     app = yield self._get_app(app_name)
     time_string = datetime.datetime.strftime(app.last_build_time,
                                              LogSettings.TIME_FORMAT)
     logs = yield self._get_app_logs(app_name, time_string)
     self.write({"logs": logs})
Example #3
0
 def get(self, organization, repo):
     super(StaticLogsHandler, self).get()
     app_name = App.make_app_name(organization, repo)
     app = yield self._get_app(app_name)
     time_string = datetime.datetime.strftime(app.last_build_time, LogSettings.TIME_FORMAT)
     filtered = self.get_query_argument('filtered', default='false').lower() == 'true'
     logs = yield self._get_app_logs(app_name, time_string, filtered)
     self.write({"logs": logs})
Example #4
0
 def get(self, organization, repo):
     super(GithubStatusHandler, self).get()
     app_name = App.make_app_name(organization, repo)
     app = yield self._get_app(app_name)
     if not app:
         self.set_status(404)
         self.write({"error": "app does not exist"})
     else:
         self._write_build_state(app)
Example #5
0
    def open(self, organization, repo):
        super(LiveLogsHandler, self).open()
        print("Opening websocket for {}/{}".format(organization, repo))
        app_name = App.make_app_name(organization, repo)

        ws_handlers.append(self)

        self._thread = LiveLogsHandler.LogsThread(app_name, self)
        self._thread.start()
Example #6
0
 def get(self, organization, repo):
     super(GithubStatusHandler, self).get()
     app_name = App.make_app_name(organization, repo)
     app = yield self._get_app(app_name)
     if not app:
         self.set_status(404)
         self.write({"error": "app does not exist"})
     else:
         self._write_build_state(app)
Example #7
0
    def open(self, organization, repo):
        super(LiveLogsHandler, self).open()
        print("Opening websocket for {}/{}".format(organization, repo))
        app_name = App.make_app_name(organization, repo)

        ws_handlers.append(self)

        self._thread = LiveLogsHandler.LogsThread(app_name, self)
        self._thread.start()
Example #8
0
File: app.py Project: mrB1B0/binder
 def get(self, organization, repo):
     super(StaticLogsHandler, self).get()
     app_name = App.make_app_name(organization, repo)
     app = yield self._get_app(app_name)
     time_string = datetime.datetime.strftime(app.last_build_time,
                                              LogSettings.TIME_FORMAT)
     filtered = self.get_query_argument('filtered',
                                        default='false').lower() == 'true'
     logs = yield self._get_app_logs(app_name, time_string, filtered)
     self.write({"logs": logs})
Example #9
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 = App.make_app_name(organization, repo)
     app = yield self._get_app(app_name)
     if app and app.build_state == App.BuildState.COMPLETED:
         redirect_url = yield self._deploy_app(app, "single-node")
         self.write({"redirect_url": redirect_url})
     else:
         self.set_status(404)
         self.write({"error": "no app available to deploy"})
Example #10
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 = App.make_app_name(organization, repo)
     app = yield self._get_app(app_name)
     if app and app.build_state == App.BuildState.COMPLETED:
         redirect_url = yield self._deploy_app(app, "single-node")
         self.write({"redirect_url": redirect_url})
     else:
         self.set_status(404)
         self.write({"error": "no app available to deploy"})
Example #11
0
 def post(self, organization, repo):
     # if the spec is properly formed, create/build the app
     super(GithubBuildHandler, self).post()
     print("request.body: {}".format(self.request.body))
     spec = json.loads(self.request.body)
     if self._is_malformed(spec):
         self.set_status(400)
         self.write({"error": "malformed app specification"})
     else:
         try:
             spec["name"] = App.make_app_name(organization, repo).lower()
             spec["repo"] = "https://www.github.com/{0}/{1}".format(organization, repo)
             build_queue.put(spec)
             self.write({"success": "app submitted to build queue"})
         except Queue.Full:
             self.write({"error": "build queue full"})
Example #12
0
 def post(self, organization, repo):
     # if the spec is properly formed, create/build the app
     super(GithubBuildHandler, self).post()
     print("request.body: {}".format(self.request.body))
     spec = json.loads(self.request.body)
     if self._is_malformed(spec):
         self.set_status(400)
         self.write({"error": "malformed app specification"})
     else:
         try:
             spec["name"] = App.make_app_name(organization, repo).lower()
             spec["repo"] = "https://www.github.com/{0}/{1}".format(
                 organization, repo)
             build_queue.put(spec)
             self.write({"success": "app submitted to build queue"})
         except Queue.Full:
             self.write({"error": "build queue full"})