Skip to content

Commit

Permalink
add v2.2 to service api
Browse files Browse the repository at this point in the history
  • Loading branch information
m-alisafaee committed Oct 4, 2023
1 parent baeb104 commit 49d2c1b
Show file tree
Hide file tree
Showing 24 changed files with 801 additions and 52 deletions.
4 changes: 2 additions & 2 deletions renku/ui/service/controllers/datasets_add_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class DatasetsAddFileCtrl(ServiceCtrl, RenkuOpSyncMixin):

def __init__(self, cache, user_data, request_data, migrate_project=False):
"""Construct a datasets add controller."""
self.ctx = DatasetsAddFileCtrl.REQUEST_SERIALIZER.load(request_data)
self.ctx = self.REQUEST_SERIALIZER.load(request_data)
self.ctx["commit_message"] = f"{MESSAGE_PREFIX} dataset add {self.ctx['slug']}"

super().__init__(cache, user_data, request_data, migrate_project=migrate_project)
Expand Down Expand Up @@ -132,4 +132,4 @@ def to_response(self):
**{"local_paths": local_paths, "enqueued_paths": enqueued_paths, "remote_branch": remote_branch},
}

return result_response(DatasetsAddFileCtrl.RESPONSE_SERIALIZER, response)
return result_response(self.RESPONSE_SERIALIZER, response)
4 changes: 2 additions & 2 deletions renku/ui/service/controllers/datasets_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class DatasetsCreateCtrl(ServiceCtrl, RenkuOpSyncMixin):

def __init__(self, cache, user_data, request_data, migrate_project=False):
"""Construct a datasets create controller."""
self.ctx = DatasetsCreateCtrl.REQUEST_SERIALIZER.load(request_data)
self.ctx = self.REQUEST_SERIALIZER.load(request_data)
self.ctx["commit_message"] = f"{MESSAGE_PREFIX} dataset create {self.ctx['slug']}"

super().__init__(cache, user_data, request_data, migrate_project)
Expand Down Expand Up @@ -91,4 +91,4 @@ def to_response(self):
op_result = self.ctx
op_result["remote_branch"] = remote_branch

return result_response(DatasetsCreateCtrl.RESPONSE_SERIALIZER, op_result)
return result_response(self.RESPONSE_SERIALIZER, op_result)
4 changes: 2 additions & 2 deletions renku/ui/service/controllers/datasets_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class DatasetsEditCtrl(ServiceCtrl, RenkuOpSyncMixin):

def __init__(self, cache, user_data, request_data, migrate_project=False):
"""Construct a datasets edit list controller."""
self.ctx = cast(Dict, DatasetsEditCtrl.REQUEST_SERIALIZER.load(request_data))
self.ctx = cast(Dict, self.REQUEST_SERIALIZER.load(request_data))
self.ctx["commit_message"] = f"{MESSAGE_PREFIX} dataset edit {self.ctx['slug']}"

super().__init__(cache, user_data, request_data, migrate_project=migrate_project)
Expand Down Expand Up @@ -142,4 +142,4 @@ def to_response(self):
"remote_branch": remote_branch,
}

return result_response(DatasetsEditCtrl.RESPONSE_SERIALIZER, response)
return result_response(self.RESPONSE_SERIALIZER, response)
4 changes: 2 additions & 2 deletions renku/ui/service/controllers/datasets_files_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class DatasetsFilesListCtrl(ServiceCtrl, RenkuOperationMixin):

def __init__(self, cache, user_data, request_data):
"""Construct a datasets files list controller."""
self.ctx = DatasetsFilesListCtrl.REQUEST_SERIALIZER.load(request_data)
self.ctx = self.REQUEST_SERIALIZER.load(request_data)

super().__init__(cache, user_data, request_data)

Expand All @@ -47,4 +47,4 @@ def renku_op(self):
def to_response(self):
"""Execute controller flow and serialize to service response."""
self.ctx["files"] = self.execute_op()
return result_response(DatasetsFilesListCtrl.RESPONSE_SERIALIZER, self.ctx)
return result_response(self.RESPONSE_SERIALIZER, self.ctx)
4 changes: 2 additions & 2 deletions renku/ui/service/controllers/datasets_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class DatasetsImportCtrl(ServiceCtrl, RenkuOpSyncMixin):

def __init__(self, cache, user_data, request_data, migrate_project=False):
"""Construct a datasets import controller."""
self.ctx = DatasetsImportCtrl.REQUEST_SERIALIZER.load(request_data)
self.ctx = self.REQUEST_SERIALIZER.load(request_data)
self.ctx["commit_message"] = f"{MESSAGE_PREFIX} dataset import of {self.ctx['dataset_uri']}"

super().__init__(cache, user_data, request_data, migrate_project=migrate_project)
Expand Down Expand Up @@ -73,4 +73,4 @@ def renku_op(self):

def to_response(self):
"""Execute controller flow and serialize to service response."""
return result_response(DatasetsImportCtrl.RESPONSE_SERIALIZER, self.execute_op())
return result_response(self.RESPONSE_SERIALIZER, self.execute_op())
4 changes: 2 additions & 2 deletions renku/ui/service/controllers/datasets_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class DatasetsListCtrl(ServiceCtrl, RenkuOperationMixin):

def __init__(self, cache, user_data, request_data):
"""Construct a datasets list controller."""
self.ctx = DatasetsListCtrl.REQUEST_SERIALIZER.load(request_data)
self.ctx = self.REQUEST_SERIALIZER.load(request_data)
super().__init__(cache, user_data, request_data)

@property
Expand All @@ -46,4 +46,4 @@ def renku_op(self):
def to_response(self):
"""Execute controller flow and serialize to service response."""
self.ctx["datasets"] = self.execute_op()
return result_response(DatasetsListCtrl.RESPONSE_SERIALIZER, self.ctx)
return result_response(self.RESPONSE_SERIALIZER, self.ctx)
4 changes: 2 additions & 2 deletions renku/ui/service/controllers/datasets_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class DatasetsRemoveCtrl(ServiceCtrl, RenkuOpSyncMixin):

def __init__(self, cache, user_data, request_data, migrate_project=False):
"""Construct a datasets remove controller."""
self.ctx = DatasetsRemoveCtrl.REQUEST_SERIALIZER.load(request_data)
self.ctx = self.REQUEST_SERIALIZER.load(request_data)
self.ctx["commit_message"] = f"{MESSAGE_PREFIX} dataset remove {self.ctx['slug']}"

super().__init__(cache, user_data, request_data, migrate_project=migrate_project)
Expand All @@ -58,4 +58,4 @@ def to_response(self):
response = self.ctx
response["remote_branch"] = remote_branch

return result_response(DatasetsRemoveCtrl.RESPONSE_SERIALIZER, response)
return result_response(self.RESPONSE_SERIALIZER, response)
4 changes: 2 additions & 2 deletions renku/ui/service/controllers/datasets_unlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class DatasetsUnlinkCtrl(ServiceCtrl, RenkuOpSyncMixin):

def __init__(self, cache, user_data, request_data, migrate_project=False):
"""Construct a datasets unlink list controller."""
self.ctx = DatasetsUnlinkCtrl.REQUEST_SERIALIZER.load(request_data)
self.ctx = self.REQUEST_SERIALIZER.load(request_data)

self.include = self.ctx.get("include_filter")
self.exclude = self.ctx.get("exclude_filter")
Expand Down Expand Up @@ -79,4 +79,4 @@ def to_response(self):
"remote_branch": remote_branch,
}

return result_response(DatasetsUnlinkCtrl.RESPONSE_SERIALIZER, response)
return result_response(self.RESPONSE_SERIALIZER, response)
26 changes: 26 additions & 0 deletions renku/ui/service/controllers/v1/datasets_add_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright Swiss Data Science Center (SDSC). A partnership between
# École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Renku service datasets add controller."""

from renku.ui.service.controllers.datasets_add_file import DatasetsAddFileCtrl
from renku.ui.service.serializers.v1.datasets import DatasetAddRequest_2_1, DatasetAddResponseRPC_2_1


class DatasetsAddFileCtrl_2_1(DatasetsAddFileCtrl):
"""Controller for datasets add endpoint."""

REQUEST_SERIALIZER = DatasetAddRequest_2_1() # type: ignore
RESPONSE_SERIALIZER = DatasetAddResponseRPC_2_1() # type: ignore
26 changes: 26 additions & 0 deletions renku/ui/service/controllers/v1/datasets_create.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright Swiss Data Science Center (SDSC). A partnership between
# École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Renku service datasets create controller."""

from renku.ui.service.controllers.datasets_create import DatasetsCreateCtrl
from renku.ui.service.serializers.v1.datasets import DatasetCreateRequest_2_1, DatasetCreateResponseRPC_2_1


class DatasetsCreateCtrl_2_1(DatasetsCreateCtrl):
"""Controller for datasets create endpoint."""

REQUEST_SERIALIZER = DatasetCreateRequest_2_1() # type: ignore
RESPONSE_SERIALIZER = DatasetCreateResponseRPC_2_1() # type: ignore
27 changes: 27 additions & 0 deletions renku/ui/service/controllers/v1/datasets_edit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright Swiss Data Science Center (SDSC). A partnership between
# École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Renku service datasets edit controller."""

from renku.ui.service.controllers.datasets_edit import DatasetsEditCtrl
from renku.ui.service.serializers.datasets import DatasetEditResponseRPC
from renku.ui.service.serializers.v1.datasets import DatasetEditRequest_2_1


class DatasetsEditCtrl_2_1(DatasetsEditCtrl):
"""Controller for datasets edit endpoint."""

REQUEST_SERIALIZER = DatasetEditRequest_2_1() # type: ignore
RESPONSE_SERIALIZER = DatasetEditResponseRPC()
26 changes: 26 additions & 0 deletions renku/ui/service/controllers/v1/datasets_files_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright Swiss Data Science Center (SDSC). A partnership between
# École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Renku service datasets files controller."""

from renku.ui.service.controllers.datasets_files_list import DatasetsFilesListCtrl
from renku.ui.service.serializers.v1.datasets import DatasetFilesListRequest_2_1, DatasetFilesListResponseRPC_2_1


class DatasetsFilesListCtrl_2_1(DatasetsFilesListCtrl):
"""Controller for datasets files list endpoint."""

REQUEST_SERIALIZER = DatasetFilesListRequest_2_1() # type: ignore
RESPONSE_SERIALIZER = DatasetFilesListResponseRPC_2_1() # type: ignore
26 changes: 26 additions & 0 deletions renku/ui/service/controllers/v1/datasets_import.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright Swiss Data Science Center (SDSC). A partnership between
# École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Renku service datasets import controller."""
from renku.ui.service.controllers.datasets_import import DatasetsImportCtrl
from renku.ui.service.serializers.datasets import DatasetImportResponseRPC
from renku.ui.service.serializers.v1.datasets import DatasetImportRequest_2_1


class DatasetsImportCtrl_2_1(DatasetsImportCtrl):
"""Controller for datasets import endpoint."""

REQUEST_SERIALIZER = DatasetImportRequest_2_1() # type: ignore
RESPONSE_SERIALIZER = DatasetImportResponseRPC()
27 changes: 27 additions & 0 deletions renku/ui/service/controllers/v1/datasets_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright Swiss Data Science Center (SDSC). A partnership between
# École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Renku service datasets list controller."""

from renku.ui.service.controllers.datasets_list import DatasetsListCtrl
from renku.ui.service.serializers.datasets import DatasetListRequest
from renku.ui.service.serializers.v1.datasets import DatasetListResponseRPC_2_1


class DatasetsListCtrl_2_1(DatasetsListCtrl):
"""Controller for datasets list endpoint."""

REQUEST_SERIALIZER = DatasetListRequest()
RESPONSE_SERIALIZER = DatasetListResponseRPC_2_1() # type: ignore
26 changes: 26 additions & 0 deletions renku/ui/service/controllers/v1/datasets_remove.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright Swiss Data Science Center (SDSC). A partnership between
# École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Renku service datasets remove controller."""

from renku.ui.service.controllers.datasets_remove import DatasetsRemoveCtrl
from renku.ui.service.serializers.v1.datasets import DatasetRemoveRequest_2_1, DatasetRemoveResponseRPC_2_1


class DatasetsRemoveCtrl_2_1(DatasetsRemoveCtrl):
"""Controller for datasets remove endpoint."""

REQUEST_SERIALIZER = DatasetRemoveRequest_2_1() # type: ignore
RESPONSE_SERIALIZER = DatasetRemoveResponseRPC_2_1() # type: ignore
27 changes: 27 additions & 0 deletions renku/ui/service/controllers/v1/datasets_unlink.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright Swiss Data Science Center (SDSC). A partnership between
# École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Renku service datasets unlink controller."""

from renku.ui.service.controllers.datasets_unlink import DatasetsUnlinkCtrl
from renku.ui.service.serializers.datasets import DatasetUnlinkResponseRPC
from renku.ui.service.serializers.v1.datasets import DatasetUnlinkRequest_2_1


class DatasetsUnlinkCtrl_2_1(DatasetsUnlinkCtrl):
"""Controller for datasets unlink endpoint."""

REQUEST_SERIALIZER = DatasetUnlinkRequest_2_1() # type: ignore
RESPONSE_SERIALIZER = DatasetUnlinkResponseRPC()
Loading

0 comments on commit 49d2c1b

Please sign in to comment.