mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-12 15:26:54 +08:00
Fix C.provider_uri
This commit is contained in:
@@ -207,14 +207,15 @@ class QlibConfig(Config):
|
|||||||
def resolve_path(self):
|
def resolve_path(self):
|
||||||
# resolve path
|
# resolve path
|
||||||
if self["mount_path"] is not None:
|
if self["mount_path"] is not None:
|
||||||
self["mount_path"]= str(Path(self["mount_path"]).expanduser().resolve())
|
self["mount_path"] = str(Path(self["mount_path"]).expanduser().resolve())
|
||||||
|
|
||||||
if self.get_uri_type() == QlibConfig.LOCAL_URI:
|
if self.get_uri_type() == QlibConfig.LOCAL_URI:
|
||||||
self["provider_uri"] = str(Path(self["provider_uri"]).expanduser().resolve())
|
self["provider_uri"] = str(Path(self["provider_uri"]).expanduser().resolve())
|
||||||
|
|
||||||
def get_uri_type(self):
|
def get_uri_type(self):
|
||||||
rm = re.match("^[^/ ]+:.+", self["provider_uri"])
|
rm = re.match("^[^/ ]+:.+", self["provider_uri"])
|
||||||
if rm is None:
|
# Windows path is "C:\\"
|
||||||
|
if rm is None or Path(self["provider_uri"]).exists():
|
||||||
return QlibConfig.LOCAL_URI
|
return QlibConfig.LOCAL_URI
|
||||||
else:
|
else:
|
||||||
return QlibConfig.NFS_URI
|
return QlibConfig.NFS_URI
|
||||||
|
|||||||
@@ -459,7 +459,7 @@ class DatasetProvider(object):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def expression_calculator(inst, start_time, end_time, freq, column_names, spans=None, C=None):
|
def expression_calculator(inst, start_time, end_time, freq, column_names, spans=None, g_config=None):
|
||||||
"""
|
"""
|
||||||
Calculate the expressions for one instrument, return a df result.
|
Calculate the expressions for one instrument, return a df result.
|
||||||
If the expression has been calculated before, load from cache.
|
If the expression has been calculated before, load from cache.
|
||||||
@@ -467,6 +467,9 @@ class DatasetProvider(object):
|
|||||||
return value: A data frame with index 'datetime' and other data columns.
|
return value: A data frame with index 'datetime' and other data columns.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
# FIXME: Windows OS or MacOS using spawn: https://docs.python.org/3.8/library/multiprocessing.html?highlight=spawn#contexts-and-start-methods
|
||||||
|
global C
|
||||||
|
C = g_config
|
||||||
# NOTE: This place is compatible with windows, windows multi-process is spawn
|
# NOTE: This place is compatible with windows, windows multi-process is spawn
|
||||||
if getattr(ExpressionD, "_provider", None) is None:
|
if getattr(ExpressionD, "_provider", None) is None:
|
||||||
register_all_wrappers()
|
register_all_wrappers()
|
||||||
|
|||||||
Reference in New Issue
Block a user