diff --git a/.github/workflows/test_qlib_from_source.yml b/.github/workflows/test_qlib_from_source.yml index 220453d60..b7041e33a 100644 --- a/.github/workflows/test_qlib_from_source.yml +++ b/.github/workflows/test_qlib_from_source.yml @@ -86,12 +86,11 @@ jobs: # W1309: f-string-without-interpolation # E1102: not-callable # E1136: unsubscriptable-object - # FIXME: Due to the version change of Pylint, some code will cause W0719 error after PR 1417. W0719 is temporarily disabled in PR 1417 and should be fixed. # References for parameters: https://github.com/PyCQA/pylint/issues/4577#issuecomment-1000245962 # We use sys.setrecursionlimit(2000) to make the recursion depth larger to ensure that pylint works properly (the default recursion depth is 1000). - name: Check Qlib with pylint run: | - pylint --disable=C0104,C0114,C0115,C0116,C0301,C0302,C0411,C0413,C1802,R0401,R0801,R0902,R0903,R0911,R0912,R0913,R0914,R0915,R1720,W0105,W0123,W0201,W0511,W0613,W1113,W1514,E0401,E1121,C0103,C0209,R0402,R1705,R1710,R1725,R1735,W0102,W0212,W0221,W0223,W0231,W0237,W0612,W0621,W0622,W0703,W1309,E1102,E1136,W0719 --const-rgx='[a-z_][a-z0-9_]{2,30}$' qlib --init-hook "import astroid; astroid.context.InferenceContext.max_inferred = 500; import sys; sys.setrecursionlimit(2000)" + pylint --disable=C0104,C0114,C0115,C0116,C0301,C0302,C0411,C0413,C1802,R0401,R0801,R0902,R0903,R0911,R0912,R0913,R0914,R0915,R1720,W0105,W0123,W0201,W0511,W0613,W1113,W1514,E0401,E1121,C0103,C0209,R0402,R1705,R1710,R1725,R1735,W0102,W0212,W0221,W0223,W0231,W0237,W0612,W0621,W0622,W0703,W1309,E1102,E1136 --const-rgx='[a-z_][a-z0-9_]{2,30}$' qlib --init-hook "import astroid; astroid.context.InferenceContext.max_inferred = 500; import sys; sys.setrecursionlimit(2000)" # The following flake8 error codes were ignored: # E501 line too long diff --git a/qlib/utils/__init__.py b/qlib/utils/__init__.py index 3bfacc288..a6dfcee60 100644 --- a/qlib/utils/__init__.py +++ b/qlib/utils/__init__.py @@ -224,7 +224,7 @@ def requests_with_retry(url, retry=5, **kwargs): except Exception as e: log.warning("exception encountered {}".format(e)) continue - raise Exception("ERROR: requests failed!") + raise TimeoutError("ERROR: requests failed!") #################### Parse #################### diff --git a/qlib/workflow/exp.py b/qlib/workflow/exp.py index d0adda66e..ae165ef1f 100644 --- a/qlib/workflow/exp.py +++ b/qlib/workflow/exp.py @@ -333,7 +333,7 @@ class MLflowExperiment(Experiment): recorder = self._get_recorder(recorder_name=recorder_name) self._client.delete_run(recorder.id) except MlflowException as e: - raise Exception( + raise ValueError( f"Error: {e}. Something went wrong when deleting recorder. Please check if the name/id of the recorder is correct." ) from e diff --git a/qlib/workflow/expm.py b/qlib/workflow/expm.py index 3059eecd1..94d17beaf 100644 --- a/qlib/workflow/expm.py +++ b/qlib/workflow/expm.py @@ -415,7 +415,7 @@ class MLflowExpManager(ExpManager): raise MlflowException("No valid experiment has been found.") self.client.delete_experiment(experiment.experiment_id) except MlflowException as e: - raise Exception( + raise ValueError( f"Error: {e}. Something went wrong when deleting experiment. Please check if the name/id of the experiment is correct." ) from e diff --git a/qlib/workflow/recorder.py b/qlib/workflow/recorder.py index 4502a6c04..25f465936 100644 --- a/qlib/workflow/recorder.py +++ b/qlib/workflow/recorder.py @@ -324,7 +324,7 @@ class MLflowRecorder(Recorder): raise RuntimeError("This recorder is not saved in the local file system.") else: - raise Exception( + raise ValueError( "Please make sure the recorder has been created and started properly before getting artifact uri." ) @@ -464,7 +464,7 @@ class MLflowRecorder(Recorder): if self.artifact_uri is not None: return self.artifact_uri else: - raise Exception( + raise ValueError( "Please make sure the recorder has been created and started properly before getting artifact uri." )