!17100 clean minddata lint
From: @luoyang42 Reviewed-by: @liucunwei,@jonyguo Signed-off-by: @liucunwei
This commit is contained in:
commit
61c96a444f
|
@ -73,7 +73,7 @@ Status TransferNode::Build(std::vector<std::shared_ptr<DatasetOp>> *const node_o
|
||||||
queue_name_ = Services::GetUniqueID();
|
queue_name_ = Services::GetUniqueID();
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME - This is an issue from MindSpore C++ user
|
// This is an issue from MindSpore C++ user
|
||||||
// https://gitee.com/mindspore/mindspore/issues/I39J9A
|
// https://gitee.com/mindspore/mindspore/issues/I39J9A
|
||||||
// Link _c_expression.so and _c_dataengine.so simultaneously will cause heap overflow because MindData uses MSContext.
|
// Link _c_expression.so and _c_dataengine.so simultaneously will cause heap overflow because MindData uses MSContext.
|
||||||
// We should find a new way to get device_type here.
|
// We should find a new way to get device_type here.
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "minddata/dataset/kernels/image/math_utils.h"
|
#include "minddata/dataset/kernels/image/math_utils.h"
|
||||||
#include "minddata/dataset/kernels/image/resize_cubic_op.h"
|
#include "minddata/dataset/kernels/image/resize_cubic_op.h"
|
||||||
|
|
||||||
#define MAX_INT_PRECISION 16777216 // float int precision is 16777216
|
const int32_t MAX_INT_PRECISION = 16777216; // float int precision is 16777216
|
||||||
namespace mindspore {
|
namespace mindspore {
|
||||||
namespace dataset {
|
namespace dataset {
|
||||||
int GetCVInterpolationMode(InterpolationMode mode) {
|
int GetCVInterpolationMode(InterpolationMode mode) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
#include "minddata/dataset/util/services.h"
|
#include "minddata/dataset/util/services.h"
|
||||||
|
|
||||||
#include <limits.h>
|
#include <climits>
|
||||||
#if !defined(_WIN32) && !defined(_WIN64) && !defined(__ANDROID__) && !defined(ANDROID) && !defined(__APPLE__)
|
#if !defined(_WIN32) && !defined(_WIN64) && !defined(__ANDROID__) && !defined(ANDROID) && !defined(__APPLE__)
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#include "minddata/dataset/util/sig_handler.h"
|
#include "minddata/dataset/util/sig_handler.h"
|
||||||
#include <signal.h>
|
#include <csignal>
|
||||||
#if !defined(_WIN32) && !defined(_WIN64) && !defined(__ANDROID__) && !defined(ANDROID) && !defined(__APPLE__)
|
#if !defined(_WIN32) && !defined(_WIN64) && !defined(__ANDROID__) && !defined(ANDROID) && !defined(__APPLE__)
|
||||||
#endif
|
#endif
|
||||||
#include "minddata/dataset/util/task_manager.h"
|
#include "minddata/dataset/util/task_manager.h"
|
||||||
|
|
|
@ -16,21 +16,25 @@
|
||||||
enums for exceptions
|
enums for exceptions
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class BaseEnum:
|
class BaseEnum:
|
||||||
"""
|
"""
|
||||||
Enum base class.
|
Enum base class.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class LogRuntime(BaseEnum):
|
class LogRuntime(BaseEnum):
|
||||||
"""Log runtime enum."""
|
"""Log runtime enum."""
|
||||||
RT_HOST = 0b01
|
RT_HOST = 0b01
|
||||||
RT_DEVICE = 0b10
|
RT_DEVICE = 0b10
|
||||||
|
|
||||||
|
|
||||||
class ErrorCodeType(BaseEnum):
|
class ErrorCodeType(BaseEnum):
|
||||||
"""Error code type enum."""
|
"""Error code type enum."""
|
||||||
ERROR_CODE = 0b01
|
ERROR_CODE = 0b01
|
||||||
EXCEPTION_CODE = 0b10
|
EXCEPTION_CODE = 0b10
|
||||||
|
|
||||||
|
|
||||||
class ErrorLevel(BaseEnum):
|
class ErrorLevel(BaseEnum):
|
||||||
"""Error level."""
|
"""Error level."""
|
||||||
COMMON_LEVEL = 0b000
|
COMMON_LEVEL = 0b000
|
||||||
|
|
|
@ -72,6 +72,7 @@ EXCEPTIONS = dict(
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class MindRecordException(Exception):
|
class MindRecordException(Exception):
|
||||||
"""MindRecord base error class."""
|
"""MindRecord base error class."""
|
||||||
|
|
||||||
|
@ -168,6 +169,7 @@ class ParamMissError(MindRecordException):
|
||||||
super(ParamMissError, self).__init__()
|
super(ParamMissError, self).__init__()
|
||||||
self.error_msg = "Param missing. '{}' is required.".format(param_name)
|
self.error_msg = "Param missing. '{}' is required.".format(param_name)
|
||||||
|
|
||||||
|
|
||||||
class PathNotExistsError(MindRecordException):
|
class PathNotExistsError(MindRecordException):
|
||||||
"""
|
"""
|
||||||
invalid path.
|
invalid path.
|
||||||
|
@ -176,6 +178,7 @@ class PathNotExistsError(MindRecordException):
|
||||||
super(PathNotExistsError, self).__init__()
|
super(PathNotExistsError, self).__init__()
|
||||||
self.error_msg = 'Invalid path. {}'.format(error_path)
|
self.error_msg = 'Invalid path. {}'.format(error_path)
|
||||||
|
|
||||||
|
|
||||||
class DbConnectionError(MindRecordException):
|
class DbConnectionError(MindRecordException):
|
||||||
"""
|
"""
|
||||||
Database connection error.
|
Database connection error.
|
||||||
|
@ -183,7 +186,8 @@ class DbConnectionError(MindRecordException):
|
||||||
def __init__(self, error_detail):
|
def __init__(self, error_detail):
|
||||||
super(DbConnectionError, self).__init__()
|
super(DbConnectionError, self).__init__()
|
||||||
self.error_msg = 'Db connection is error. Detail: {}'.format(error_detail)
|
self.error_msg = 'Db connection is error. Detail: {}'.format(error_detail)
|
||||||
##
|
|
||||||
|
|
||||||
class MRMOpenError(MindRecordException):
|
class MRMOpenError(MindRecordException):
|
||||||
"""
|
"""
|
||||||
Raised when could not open mind record file successfully.
|
Raised when could not open mind record file successfully.
|
||||||
|
@ -192,6 +196,7 @@ class MRMOpenError(MindRecordException):
|
||||||
super(MRMOpenError, self).__init__()
|
super(MRMOpenError, self).__init__()
|
||||||
self.error_msg = 'MindRecord File could not open successfully.'
|
self.error_msg = 'MindRecord File could not open successfully.'
|
||||||
|
|
||||||
|
|
||||||
class MRMOpenForAppendError(MindRecordException):
|
class MRMOpenForAppendError(MindRecordException):
|
||||||
"""
|
"""
|
||||||
Raised when could not open mind record file successfully for append.
|
Raised when could not open mind record file successfully for append.
|
||||||
|
@ -200,85 +205,109 @@ class MRMOpenForAppendError(MindRecordException):
|
||||||
super(MRMOpenForAppendError, self).__init__()
|
super(MRMOpenForAppendError, self).__init__()
|
||||||
self.error_msg = 'MindRecord File could not open successfully for append.'
|
self.error_msg = 'MindRecord File could not open successfully for append.'
|
||||||
|
|
||||||
|
|
||||||
class MRMInvalidPageSizeError(MindRecordException):
|
class MRMInvalidPageSizeError(MindRecordException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MRMInvalidHeaderSizeError(MindRecordException):
|
class MRMInvalidHeaderSizeError(MindRecordException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MRMSetHeaderError(MindRecordException):
|
class MRMSetHeaderError(MindRecordException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MRMWriteDatasetError(MindRecordException):
|
class MRMWriteDatasetError(MindRecordException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MRMCommitError(MindRecordException):
|
class MRMCommitError(MindRecordException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MRMLaunchError(MindRecordException):
|
class MRMLaunchError(MindRecordException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MRMFinishError(MindRecordException):
|
class MRMFinishError(MindRecordException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MRMCloseError(MindRecordException):
|
class MRMCloseError(MindRecordException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MRMAddSchemaError(MindRecordException):
|
class MRMAddSchemaError(MindRecordException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MRMAddIndexError(MindRecordException):
|
class MRMAddIndexError(MindRecordException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MRMBuildSchemaError(MindRecordException):
|
class MRMBuildSchemaError(MindRecordException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MRMGetMetaError(MindRecordException):
|
class MRMGetMetaError(MindRecordException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MRMIndexGeneratorError(MindRecordException):
|
class MRMIndexGeneratorError(MindRecordException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MRMGenerateIndexError(MindRecordException):
|
class MRMGenerateIndexError(MindRecordException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MRMInitSegmentError(MindRecordException):
|
class MRMInitSegmentError(MindRecordException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MRMFetchCandidateFieldsError(MindRecordException):
|
class MRMFetchCandidateFieldsError(MindRecordException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MRMReadCategoryInfoError(MindRecordException):
|
class MRMReadCategoryInfoError(MindRecordException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MRMFetchDataError(MindRecordException):
|
class MRMFetchDataError(MindRecordException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MRMInvalidSchemaError(MindRecordException):
|
class MRMInvalidSchemaError(MindRecordException):
|
||||||
def __init__(self, error_detail):
|
def __init__(self, error_detail):
|
||||||
super(MRMInvalidSchemaError, self).__init__()
|
super(MRMInvalidSchemaError, self).__init__()
|
||||||
self.error_msg = 'Schema format is error. Detail: {}'.format(error_detail)
|
self.error_msg = 'Schema format is error. Detail: {}'.format(error_detail)
|
||||||
|
|
||||||
|
|
||||||
class MRMValidateDataError(MindRecordException):
|
class MRMValidateDataError(MindRecordException):
|
||||||
def __init__(self, error_detail):
|
def __init__(self, error_detail):
|
||||||
super(MRMValidateDataError, self).__init__()
|
super(MRMValidateDataError, self).__init__()
|
||||||
self.error_msg = 'Raw data do not match the schema. Detail: {}'.format(error_detail)
|
self.error_msg = 'Raw data do not match the schema. Detail: {}'.format(error_detail)
|
||||||
|
|
||||||
|
|
||||||
class MRMDefineIndexError(MindRecordException):
|
class MRMDefineIndexError(MindRecordException):
|
||||||
def __init__(self, error_detail):
|
def __init__(self, error_detail):
|
||||||
super(MRMDefineIndexError, self).__init__()
|
super(MRMDefineIndexError, self).__init__()
|
||||||
self.error_msg = 'Failed to define index field. Detail: {}'.format(error_detail)
|
self.error_msg = 'Failed to define index field. Detail: {}'.format(error_detail)
|
||||||
|
|
||||||
|
|
||||||
class MRMDefineBlobError(MindRecordException):
|
class MRMDefineBlobError(MindRecordException):
|
||||||
def __init__(self, error_detail):
|
def __init__(self, error_detail):
|
||||||
super(MRMDefineBlobError, self).__init__()
|
super(MRMDefineBlobError, self).__init__()
|
||||||
self.error_msg = 'Failed to define blob field. Detail: {}'.format(error_detail)
|
self.error_msg = 'Failed to define blob field. Detail: {}'.format(error_detail)
|
||||||
|
|
||||||
|
|
||||||
class MRMUnsupportedSchemaError(MindRecordException):
|
class MRMUnsupportedSchemaError(MindRecordException):
|
||||||
def __init__(self, error_detail):
|
def __init__(self, error_detail):
|
||||||
super(MRMUnsupportedSchemaError, self).__init__()
|
super(MRMUnsupportedSchemaError, self).__init__()
|
||||||
self.error_msg = 'Schema is not supported. Detail: {}'.format(error_detail)
|
self.error_msg = 'Schema is not supported. Detail: {}'.format(error_detail)
|
||||||
|
|
||||||
|
|
||||||
class MRMDefineCategoryError(MindRecordException):
|
class MRMDefineCategoryError(MindRecordException):
|
||||||
def __init__(self, error_detail):
|
def __init__(self, error_detail):
|
||||||
super(MRMDefineCategoryError, self).__init__()
|
super(MRMDefineCategoryError, self).__init__()
|
||||||
|
|
|
@ -21,6 +21,7 @@ from .common.exceptions import MRMAddSchemaError, MRMAddIndexError, MRMBuildSche
|
||||||
|
|
||||||
__all__ = ['ShardHeader']
|
__all__ = ['ShardHeader']
|
||||||
|
|
||||||
|
|
||||||
class ShardHeader:
|
class ShardHeader:
|
||||||
"""
|
"""
|
||||||
Wrapper class which is represent ShardHeader class in c++ module.
|
Wrapper class which is represent ShardHeader class in c++ module.
|
||||||
|
|
|
@ -21,6 +21,7 @@ from .common.exceptions import MRMIndexGeneratorError, MRMGenerateIndexError
|
||||||
|
|
||||||
__all__ = ['ShardIndexGenerator']
|
__all__ = ['ShardIndexGenerator']
|
||||||
|
|
||||||
|
|
||||||
class ShardIndexGenerator:
|
class ShardIndexGenerator:
|
||||||
"""
|
"""
|
||||||
Wrapper class which is represent ShardIndexGenerator class in c++ module.
|
Wrapper class which is represent ShardIndexGenerator class in c++ module.
|
||||||
|
|
|
@ -20,6 +20,7 @@ from mindspore import log as logger
|
||||||
from .common.exceptions import MRMOpenError, MRMLaunchError
|
from .common.exceptions import MRMOpenError, MRMLaunchError
|
||||||
__all__ = ['ShardReader']
|
__all__ = ['ShardReader']
|
||||||
|
|
||||||
|
|
||||||
class ShardReader:
|
class ShardReader:
|
||||||
"""
|
"""
|
||||||
Wrapper class which is represent ShardReader class in c++ module.
|
Wrapper class which is represent ShardReader class in c++ module.
|
||||||
|
|
|
@ -23,6 +23,7 @@ from .common.exceptions import MRMOpenError, MRMFetchCandidateFieldsError, MRMRe
|
||||||
|
|
||||||
__all__ = ['ShardSegment']
|
__all__ = ['ShardSegment']
|
||||||
|
|
||||||
|
|
||||||
class ShardSegment:
|
class ShardSegment:
|
||||||
"""
|
"""
|
||||||
Wrapper class which is represent ShardSegment class in c++ module.
|
Wrapper class which is represent ShardSegment class in c++ module.
|
||||||
|
|
|
@ -67,6 +67,7 @@ class ExceptionThread(threading.Thread):
|
||||||
self.exception = e
|
self.exception = e
|
||||||
self.exc_traceback = ''.join(traceback.format_exception(*sys.exc_info()))
|
self.exc_traceback = ''.join(traceback.format_exception(*sys.exc_info()))
|
||||||
|
|
||||||
|
|
||||||
def check_filename(path, arg_name=""):
|
def check_filename(path, arg_name=""):
|
||||||
"""
|
"""
|
||||||
check the filename in the path.
|
check the filename in the path.
|
||||||
|
@ -106,6 +107,7 @@ def check_filename(path, arg_name=""):
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def check_parameter(func):
|
def check_parameter(func):
|
||||||
"""
|
"""
|
||||||
decorator for parameter check
|
decorator for parameter check
|
||||||
|
@ -136,6 +138,7 @@ def check_parameter(func):
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
def populate_data(raw, blob, columns, blob_fields, schema):
|
def populate_data(raw, blob, columns, blob_fields, schema):
|
||||||
"""
|
"""
|
||||||
Reconstruct data form raw and blob data.
|
Reconstruct data form raw and blob data.
|
||||||
|
|
|
@ -34,6 +34,7 @@ safe_builtins = {
|
||||||
'slice',
|
'slice',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class RestrictedUnpickler(pickle.Unpickler):
|
class RestrictedUnpickler(pickle.Unpickler):
|
||||||
"""
|
"""
|
||||||
Unpickle allowing only few safe classes from the builtins module or numpy
|
Unpickle allowing only few safe classes from the builtins module or numpy
|
||||||
|
@ -52,6 +53,7 @@ class RestrictedUnpickler(pickle.Unpickler):
|
||||||
# Forbid everything else.
|
# Forbid everything else.
|
||||||
raise pickle.UnpicklingError("global '%s.%s' is forbidden" % (module, name))
|
raise pickle.UnpicklingError("global '%s.%s' is forbidden" % (module, name))
|
||||||
|
|
||||||
|
|
||||||
def restricted_loads(s):
|
def restricted_loads(s):
|
||||||
"""Helper function analogous to pickle.loads()."""
|
"""Helper function analogous to pickle.loads()."""
|
||||||
if isinstance(s, str):
|
if isinstance(s, str):
|
||||||
|
|
|
@ -33,6 +33,7 @@ safe_builtins = {
|
||||||
'slice',
|
'slice',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class RestrictedUnpickler(pickle.Unpickler):
|
class RestrictedUnpickler(pickle.Unpickler):
|
||||||
"""
|
"""
|
||||||
Unpickle allowing only few safe classes from the builtins module or numpy
|
Unpickle allowing only few safe classes from the builtins module or numpy
|
||||||
|
@ -51,6 +52,7 @@ class RestrictedUnpickler(pickle.Unpickler):
|
||||||
# Forbid everything else.
|
# Forbid everything else.
|
||||||
raise pickle.UnpicklingError("global '%s.%s' is forbidden" % (module, name))
|
raise pickle.UnpicklingError("global '%s.%s' is forbidden" % (module, name))
|
||||||
|
|
||||||
|
|
||||||
def restricted_loads(s):
|
def restricted_loads(s):
|
||||||
"""Helper function analogous to pickle.loads()."""
|
"""Helper function analogous to pickle.loads()."""
|
||||||
if isinstance(s, str):
|
if isinstance(s, str):
|
||||||
|
|
Loading…
Reference in New Issue