Skip to content

Commit

Permalink
feat!: remove deprecated deepaas-predict
Browse files Browse the repository at this point in the history
Fixes #154
  • Loading branch information
alvarolopez committed Jun 12, 2024
1 parent 9a9602e commit 097cc83
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 321 deletions.
164 changes: 0 additions & 164 deletions deepaas/cmd/execute.py

This file was deleted.

54 changes: 0 additions & 54 deletions deepaas/tests/test_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,10 @@
# License for the specific language governing permissions and limitations
# under the License.

import os
import shutil
import sys
import urllib.request

import mock

from deepaas.cmd import execute
from deepaas.cmd import run
from deepaas.tests import base

Expand Down Expand Up @@ -62,53 +58,3 @@ def test_run_custom_ip_port(self, m_get_app, m_run_app, m_handle_signals):
port=port,
)
m_handle_signals.assert_called_once()


class TestExecute(base.TestCase):
@mock.patch("deepaas.cmd.execute.prediction")
def test_execute_data(self, m_out_pred):
in_file = "file"
out_file = "deepaas/tests/out_test/"
self.flags(input_file=in_file)
self.flags(output=out_file)
m_out_pred.return_value = [{"value1": {"pred": 1}, "value2": {"pred": 0.9}}]
with mock.patch.object(sys, "argv", ["deepaas-predict"]):
execute.main()

@mock.patch("deepaas.cmd.execute.prediction")
def test_execute_url(self, m_out_pred):
in_file = "https://xxxxxxxxxx"
out_file = "deepaas/tests/out_test/"
self.flags(input_file=in_file)
self.flags(output=out_file)
self.flags(url=True)
m_out_pred.return_value = [{"value1": {"pred": 1}, "value2": {"pred": 0.9}}]
with mock.patch.object(sys, "argv", ["deepaas-predict"]):
execute.main()

@mock.patch("deepaas.cmd.execute.prediction")
def test_execute_ct(self, m_out_pred):
in_file = "file"
out_file = "deepaas/tests/out_test/"
cont_type = "application/zip"
self.flags(input_file=in_file)
self.flags(output=out_file)
self.flags(content_type=cont_type)
output_dir = "deepaas/tests/tmp_dir"
if os.path.exists(output_dir):
shutil.rmtree(output_dir)
os.mkdir(output_dir)
out_json = [{"value1": {"pred": 1}, "value2": {"pred": 0.9}}]
f_json = open(output_dir + "output" + ".json", "w+")
f_json.write(repr(out_json) + "\n")
f_json.close
url = "https://storage.googleapis.com/" "tfjs-models/assets/posenet/frisbee.jpg"
urllib.request.urlretrieve(url, "example_image.jpg")
shutil.move(f_json.name, output_dir)
shutil.move("example_image.jpg", output_dir)
f = shutil.make_archive(base_name=output_dir, format="zip", root_dir=output_dir)
m_out_pred.return_value = open(f, "rb")
with mock.patch.object(sys, "argv", ["deepaas-predict"]):
execute.main()
shutil.rmtree(output_dir)
os.remove(output_dir + ".zip")
63 changes: 0 additions & 63 deletions doc/source/cli/deepaas-predict.rst

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/cli/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ Available commands
:maxdepth: 1

deepaas-cli
deepaas-predict
deepaas-run
36 changes: 0 additions & 36 deletions doc/source/user/predict.rst

This file was deleted.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ classifiers = [

[tool.poetry.scripts]
deepaas-run = "deepaas.cmd.run:main"
deepaas-predict = "deepaas.cmd.execute:main"
deepaas-cli = "deepaas.cmd.cli:main"

[tool.poetry.plugins] # Optional super table
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
deprecations:
upgrade:
- |
The command ``deepaas-predict`` is now deprecated, please use ``deepaas-cli`` instead.
The command ``deepaas-predict`` has been removed, please use ``deepaas-cli`` instead.

0 comments on commit 097cc83

Please sign in to comment.