Skip to content

Commit ef413b2

Browse files
committed
Remove fallback argument loading
Sem-Ver: api-break
1 parent d2e8f02 commit ef413b2

File tree

2 files changed

+14
-36
lines changed

2 files changed

+14
-36
lines changed

deepaas/model/v2/wrapper.py

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828

2929
from aiohttp import web
3030
import marshmallow
31-
from webargs import fields
3231

3332
from oslo_config import cfg
3433
from oslo_log import log
@@ -324,57 +323,27 @@ def get_train_args(self):
324323
325324
:param parser: an argparse like object
326325
327-
This method will call the wrapped model ``add_train_args``. If the
328-
underlying methid implements the DEPRECATED way of passing arguments
329-
we will try to load them from there.
326+
This method will call the wrapped model ``add_train_args``.
330327
"""
331328
try:
332329
args = self.model_obj.get_train_args()
333-
args = self._convert_old_args(args)
334-
return args
335330
except (NotImplementedError, AttributeError):
336-
return {}
331+
args = {}
332+
return args
337333

338334
def get_predict_args(self):
339335
"""Add predict arguments into the predict parser.
340336
341337
:param parser: an argparse like object
342338
343-
This method will call the wrapped model ``get_predict_args``. If the
344-
method does not exist, but the wrapped model implements the DEPRECATED
345-
``get_test_args`` we will try to load the arguments from there.
339+
This method will call the wrapped model ``get_predict_args``.
346340
"""
347341
try:
348342
args = self.model_obj.get_predict_args()
349343
except (NotImplementedError, AttributeError):
350-
try:
351-
args = self.model_obj.get_test_args()
352-
args = self._convert_old_args(args)
353-
except (NotImplementedError, AttributeError):
354-
args = {}
344+
args = {}
355345
return args
356346

357-
def _convert_old_args(self, args):
358-
aux = {}
359-
for k, v in args.items():
360-
if isinstance(v, dict):
361-
LOG.warning("Loading arguments using the old and DEPRECATED "
362-
"return value (i.e. an plain Python dictionary. "
363-
"You should move to the new return value (i.e. a "
364-
"webargs.fields dictionary as soon as possible. "
365-
"All the loaded arguments will be converted to "
366-
"strings. This is only supported for backwards "
367-
"compatibility and may lead to unexpected errors. "
368-
"Argument raising this warningr: '%s'", k)
369-
370-
v = fields.Str(
371-
missing=v.get("default"),
372-
description=v.get("help"),
373-
required=v.get("required"),
374-
)
375-
aux[k] = v
376-
return aux
377-
378347

379348
class NonDaemonProcess(multiprocessing.context.SpawnProcess):
380349
"""Processes must use 'spawn' instead of 'fork' (which is the default
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
prelude: >
3+
Fallback loading of arguments (from V1 style) is now removed.
4+
upgrade:
5+
- |
6+
The old way of returning the arguments, to load the arguments using the old
7+
``get_*_args`` functions is now removed. If you were still relying on them
8+
(check the logs) you must migrate to using the argument parser as soon as
9+
possible.

0 commit comments

Comments
 (0)