Browse Source

limit the value of reload_interval

tags/v1.1.0
shenghong96 5 years ago
parent
commit
5b6bc3abae
2 changed files with 3 additions and 2 deletions
  1. +2
    -2
      mindinsight/common/hook/datavisual.py
  2. +1
    -0
      mindinsight/conf/constants.py

+ 2
- 2
mindinsight/common/hook/datavisual.py View File

@@ -35,8 +35,8 @@ class ReloadIntervalAction(argparse.Action):
option_string (str): Option string for specific argument name.
"""
reload_interval = values
if reload_interval < 0:
parser.error(f'{option_string} should be greater than or equal to 0')
if reload_interval < 0 or reload_interval > settings.MAX_RELOAD_INTERVAL:
parser.error(f'{option_string} should be greater than or equal to 0 or less than or equal to 300 ')
setattr(namespace, self.dest, reload_interval)


+ 1
- 0
mindinsight/conf/constants.py View File

@@ -57,6 +57,7 @@ DEFAULT_STEP_SIZES_PER_TAG = 500
MAX_GRAPH_TAG_SIZE = 10
MAX_TENSOR_TAG_SIZE = 6
MAX_IMAGE_STEP_SIZE_PER_TAG = 10
MAX_RELOAD_INTERVAL = 300
MAX_SCALAR_STEP_SIZE_PER_TAG = 1000
MAX_GRAPH_STEP_SIZE_PER_TAG = 1
MAX_HISTOGRAM_STEP_SIZE_PER_TAG = 50


Loading…
Cancel
Save