|
@@ -115,24 +115,24 @@ class WebServer:
|
|
self.port = settings.port
|
|
self.port = settings.port
|
|
|
|
|
|
# create notification manager
|
|
# create notification manager
|
|
- jobs = JobRunner()
|
|
|
|
- pipelines = PipelineCache(jobs)
|
|
|
|
- notifications = NotificationManager(self.__sio)
|
|
|
|
|
|
+ self.jobs = JobRunner()
|
|
|
|
+ self.pipelines = PipelineCache(self.jobs)
|
|
|
|
+ self.notifications = NotificationManager(self.__sio)
|
|
|
|
|
|
- jobs.on_create(notifications.create_job)
|
|
|
|
- jobs.on_start(notifications.edit_job)
|
|
|
|
- jobs.on_progress(notifications.edit_job)
|
|
|
|
- jobs.on_finish(notifications.edit_job)
|
|
|
|
- jobs.on_remove(notifications.remove_job)
|
|
|
|
|
|
+ self.jobs.on_create(self.notifications.create_job)
|
|
|
|
+ self.jobs.on_start(self.notifications.edit_job)
|
|
|
|
+ self.jobs.on_progress(self.notifications.edit_job)
|
|
|
|
+ self.jobs.on_finish(self.notifications.edit_job)
|
|
|
|
+ self.jobs.on_remove(self.notifications.remove_job)
|
|
|
|
|
|
- self.define_routes(jobs, notifications, pipelines)
|
|
|
|
|
|
+ self.define_routes()
|
|
|
|
|
|
if discovery:
|
|
if discovery:
|
|
Model.discover("models/")
|
|
Model.discover("models/")
|
|
LabelProvider.discover("labels/")
|
|
LabelProvider.discover("labels/")
|
|
|
|
|
|
|
|
|
|
- def define_routes(self, jobs, notifications, pipelines):
|
|
|
|
|
|
+ def define_routes(self):
|
|
""" defines app routes """
|
|
""" defines app routes """
|
|
|
|
|
|
# additional
|
|
# additional
|
|
@@ -144,11 +144,11 @@ class WebServer:
|
|
# jobs
|
|
# jobs
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/jobs',
|
|
'/jobs',
|
|
- view_func=ListJobs.as_view('list_jobs', jobs)
|
|
|
|
|
|
+ view_func=ListJobs.as_view('list_jobs', self.jobs)
|
|
)
|
|
)
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/jobs/<job_id>/remove',
|
|
'/jobs/<job_id>/remove',
|
|
- view_func=RemoveJob.as_view('remove_job', jobs)
|
|
|
|
|
|
+ view_func=RemoveJob.as_view('remove_job', self.jobs)
|
|
)
|
|
)
|
|
|
|
|
|
# models
|
|
# models
|
|
@@ -176,19 +176,19 @@ class WebServer:
|
|
)
|
|
)
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/projects/<int:project_id>/labels',
|
|
'/projects/<int:project_id>/labels',
|
|
- view_func=CreateLabel.as_view('create_label', notifications)
|
|
|
|
|
|
+ view_func=CreateLabel.as_view('create_label', self.notifications)
|
|
)
|
|
)
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/projects/<int:project_id>/labels/<int:label_id>/remove',
|
|
'/projects/<int:project_id>/labels/<int:label_id>/remove',
|
|
- view_func=RemoveLabel.as_view('remove_label', notifications)
|
|
|
|
|
|
+ view_func=RemoveLabel.as_view('remove_label', self.notifications)
|
|
)
|
|
)
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/projects/<int:project_id>/labels/<int:label_id>/name',
|
|
'/projects/<int:project_id>/labels/<int:label_id>/name',
|
|
- view_func=EditLabelName.as_view('edit_label_name', notifications)
|
|
|
|
|
|
+ view_func=EditLabelName.as_view('edit_label_name', self.notifications)
|
|
)
|
|
)
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/projects/<int:project_id>/labels/<int:label_id>/parent',
|
|
'/projects/<int:project_id>/labels/<int:label_id>/parent',
|
|
- view_func=EditLabelParent.as_view('edit_label_parent', notifications)
|
|
|
|
|
|
+ view_func=EditLabelParent.as_view('edit_label_parent', self.notifications)
|
|
)
|
|
)
|
|
|
|
|
|
# collections
|
|
# collections
|
|
@@ -204,7 +204,7 @@ class WebServer:
|
|
# data
|
|
# data
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/projects/<int:project_id>/data',
|
|
'/projects/<int:project_id>/data',
|
|
- view_func=UploadFile.as_view('upload_file', notifications)
|
|
|
|
|
|
+ view_func=UploadFile.as_view('upload_file', self.notifications)
|
|
)
|
|
)
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/projects/<int:project_id>/data',
|
|
'/projects/<int:project_id>/data',
|
|
@@ -216,7 +216,7 @@ class WebServer:
|
|
)
|
|
)
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/data/<int:file_id>/remove',
|
|
'/data/<int:file_id>/remove',
|
|
- view_func=RemoveFile.as_view('remove_file', notifications)
|
|
|
|
|
|
+ view_func=RemoveFile.as_view('remove_file', self.notifications)
|
|
)
|
|
)
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/data/<int:file_id>',
|
|
'/data/<int:file_id>',
|
|
@@ -246,28 +246,28 @@ class WebServer:
|
|
)
|
|
)
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/data/<int:file_id>/results',
|
|
'/data/<int:file_id>/results',
|
|
- view_func=CreateResult.as_view('create_result', notifications)
|
|
|
|
|
|
+ view_func=CreateResult.as_view('create_result', self.notifications)
|
|
)
|
|
)
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/data/<int:file_id>/reset',
|
|
'/data/<int:file_id>/reset',
|
|
- view_func=ResetResults.as_view('reset_results', notifications)
|
|
|
|
|
|
+ view_func=ResetResults.as_view('reset_results', self.notifications)
|
|
)
|
|
)
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/results/<int:result_id>/remove',
|
|
'/results/<int:result_id>/remove',
|
|
- view_func=RemoveResult.as_view('remove_result', notifications)
|
|
|
|
|
|
+ view_func=RemoveResult.as_view('remove_result', self.notifications)
|
|
)
|
|
)
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/results/<int:result_id>/confirm',
|
|
'/results/<int:result_id>/confirm',
|
|
- view_func=ConfirmResult.as_view('confirm_result', notifications)
|
|
|
|
|
|
+ view_func=ConfirmResult.as_view('confirm_result', self.notifications)
|
|
)
|
|
)
|
|
|
|
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/results/<int:result_id>/label',
|
|
'/results/<int:result_id>/label',
|
|
- view_func=EditResultLabel.as_view('edit_result_label', notifications)
|
|
|
|
|
|
+ view_func=EditResultLabel.as_view('edit_result_label', self.notifications)
|
|
)
|
|
)
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/results/<int:result_id>/data',
|
|
'/results/<int:result_id>/data',
|
|
- view_func=EditResultData.as_view('edit_result_data', notifications)
|
|
|
|
|
|
+ view_func=EditResultData.as_view('edit_result_data', self.notifications)
|
|
)
|
|
)
|
|
|
|
|
|
# projects
|
|
# projects
|
|
@@ -277,43 +277,45 @@ class WebServer:
|
|
)
|
|
)
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/projects',
|
|
'/projects',
|
|
- view_func=CreateProject.as_view('create_project', notifications, jobs)
|
|
|
|
|
|
+ view_func=CreateProject.as_view('create_project', self.notifications, self.jobs)
|
|
)
|
|
)
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/projects/<int:project_id>/label_provider',
|
|
'/projects/<int:project_id>/label_provider',
|
|
- view_func=ExecuteLabelProvider.as_view('execute_label_provider', notifications, jobs)
|
|
|
|
|
|
+ view_func=ExecuteLabelProvider.as_view('execute_label_provider',
|
|
|
|
+ self.notifications, self.jobs)
|
|
)
|
|
)
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/projects/<int:project_id>/external_storage',
|
|
'/projects/<int:project_id>/external_storage',
|
|
view_func=ExecuteExternalStorage.as_view('execute_external_storage',
|
|
view_func=ExecuteExternalStorage.as_view('execute_external_storage',
|
|
- notifications, jobs)
|
|
|
|
|
|
+ self.notifications, self.jobs)
|
|
)
|
|
)
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/projects/<int:project_id>/remove',
|
|
'/projects/<int:project_id>/remove',
|
|
- view_func=RemoveProject.as_view('remove_project', notifications)
|
|
|
|
|
|
+ view_func=RemoveProject.as_view('remove_project', self.notifications)
|
|
)
|
|
)
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/projects/<int:project_id>/name',
|
|
'/projects/<int:project_id>/name',
|
|
- view_func=EditProjectName.as_view('edit_project_name', notifications)
|
|
|
|
|
|
+ view_func=EditProjectName.as_view('edit_project_name', self.notifications)
|
|
)
|
|
)
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/projects/<int:project_id>/description',
|
|
'/projects/<int:project_id>/description',
|
|
- view_func=EditProjectDescription.as_view('edit_project_description', notifications)
|
|
|
|
|
|
+ view_func=EditProjectDescription.as_view('edit_project_description', self.notifications)
|
|
)
|
|
)
|
|
|
|
|
|
# pipelines
|
|
# pipelines
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/projects/<int:project_id>/pipelines/fit',
|
|
'/projects/<int:project_id>/pipelines/fit',
|
|
- view_func=FitModel.as_view('fit_model', jobs, pipelines)
|
|
|
|
|
|
+ view_func=FitModel.as_view('fit_model', self.jobs, self.pipelines)
|
|
)
|
|
)
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/projects/<int:project_id>/pipelines/predict',
|
|
'/projects/<int:project_id>/pipelines/predict',
|
|
- view_func=PredictModel.as_view('predict_model', notifications, jobs,
|
|
|
|
- pipelines)
|
|
|
|
|
|
+ view_func=PredictModel.as_view('predict_model', self.notifications, self.jobs,
|
|
|
|
+ self.pipelines)
|
|
)
|
|
)
|
|
self.app.add_url_rule(
|
|
self.app.add_url_rule(
|
|
'/data/<int:file_id>/predict',
|
|
'/data/<int:file_id>/predict',
|
|
- view_func=PredictFile.as_view('predict_file', notifications, jobs, pipelines)
|
|
|
|
|
|
+ view_func=PredictFile.as_view('predict_file', self.notifications,
|
|
|
|
+ self.jobs, self.pipelines)
|
|
)
|
|
)
|
|
|
|
|
|
def run(self):
|
|
def run(self):
|