(
self, instruments, fields, start_time=None, end_time=None, freq="day", disk_cache=0, inst_processors=[]
)
| 747 | return features |
| 748 | |
| 749 | def _dataset_uri( |
| 750 | self, instruments, fields, start_time=None, end_time=None, freq="day", disk_cache=0, inst_processors=[] |
| 751 | ): |
| 752 | if disk_cache == 0: |
| 753 | # In this case, server only checks the expression cache. |
| 754 | # The client will load the cache data by itself. |
| 755 | from .data import LocalDatasetProvider # pylint: disable=C0415 |
| 756 | |
| 757 | LocalDatasetProvider.multi_cache_walker(instruments, fields, start_time, end_time, freq) |
| 758 | return "" |
| 759 | # FIXME: The cache after resample, when read again and intercepted with end_time, results in incomplete data date |
| 760 | if inst_processors: |
| 761 | raise ValueError( |
| 762 | f"{self.__class__.__name__} does not support inst_processor. " |
| 763 | f"Please use `D.features(disk_cache=0)` or `qlib.init(dataset_cache=None)`" |
| 764 | ) |
| 765 | _cache_uri = self._uri( |
| 766 | instruments=instruments, |
| 767 | fields=fields, |
| 768 | start_time=None, |
| 769 | end_time=None, |
| 770 | freq=freq, |
| 771 | disk_cache=disk_cache, |
| 772 | inst_processors=inst_processors, |
| 773 | ) |
| 774 | cache_path = self.get_cache_dir(freq).joinpath(_cache_uri) |
| 775 | |
| 776 | if self.check_cache_exists(cache_path): |
| 777 | self.logger.debug(f"The cache dataset has already existed {cache_path}. Return the uri directly") |
| 778 | with CacheUtils.reader_lock(self.r, f"{str(C.dpm.get_data_uri(freq))}:dataset-{_cache_uri}"): |
| 779 | CacheUtils.visit(cache_path) |
| 780 | return _cache_uri |
| 781 | else: |
| 782 | # cache unavailable, generate the cache |
| 783 | with CacheUtils.writer_lock(self.r, f"{str(C.dpm.get_data_uri(freq))}:dataset-{_cache_uri}"): |
| 784 | self.gen_dataset_cache( |
| 785 | cache_path=cache_path, |
| 786 | instruments=instruments, |
| 787 | fields=fields, |
| 788 | freq=freq, |
| 789 | inst_processors=inst_processors, |
| 790 | ) |
| 791 | return _cache_uri |
| 792 | |
| 793 | class IndexManager: |
| 794 | """ |
nothing calls this directly
no test coverage detected