def dataset(self, instruments, fields, start_time=None, end_time=None, freq='day', disk_cache=0, return_uri=False):
    if (Inst.get_inst_type(instruments) == Inst.DICT):
        get_module_logger('data').warning('Getting features from a dict of instruments is not recommended because the features will not be cached! The dict of instruments will be cleaned every day.')
    if (disk_cache == 0):
        '\n            Call the server to generate the expression cache.\n            Then load the data from the expression cache directly.\n            - default using multi-kernel method.\n\n            '
        self.conn.send_request(request_type='feature', request_content={'instruments': instruments, 'fields': fields, 'start_time': start_time, 'end_time': end_time, 'freq': freq, 'disk_cache': 0}, msg_queue=self.queue)
        feature_uri = self.queue.get(timeout=C['timeout'])
        if isinstance(feature_uri, Exception):
            raise feature_uri
        else:
            instruments_d = self.get_instruments_d(instruments, freq)
            column_names = self.get_column_names(fields)
            cal = Cal.calendar(start_time, end_time, freq)
            if (len(cal) == 0):
                return pd.DataFrame(columns=column_names)
            start_time = cal[0]
            end_time = cal[(- 1)]
            data = self.dataset_processor(instruments_d, column_names, start_time, end_time, freq)
            if return_uri:
                return (data, feature_uri)
            else:
                return data
    else:
        '\n            Call the server to generate the data-set cache, get the uri of the cache file.\n            Then load the data from the file on NFS directly.\n            - using single-process implementation.\n\n            '
        self.conn.send_request(request_type='feature', request_content={'instruments': instruments, 'fields': fields, 'start_time': start_time, 'end_time': end_time, 'freq': freq, 'disk_cache': 1}, msg_queue=self.queue)
        feature_uri = self.queue.get(timeout=C['timeout'])
        if isinstance(feature_uri, Exception):
            raise feature_uri
        get_module_logger('data').debug('get result')
        try:
            mnt_feature_uri = os.path.join(C.mount_path, C.dataset_cache_dir_name, feature_uri)
            df = DiskDatasetCache.read_data_from_cache(mnt_feature_uri, start_time, end_time, fields)
            get_module_logger('data').debug('finish slicing data')
            if return_uri:
                return (df, feature_uri)
            return df
        except AttributeError:
            raise IOError('Unable to fetch instruments from remote server!')
def dataset(self, instruments, fields, start_time=None, end_time=None, freq='day', disk_cache=0, return_uri=False):
    if (Inst.get_inst_type(instruments) == Inst.DICT):
        get_module_logger('data').warning('Getting features from a dict of instruments is not recommended because the features will not be cached! The dict of instruments will be cleaned every day.')
    if (disk_cache == 0):
        '\n            Call the server to generate the expression cache.\n            Then load the data from the expression cache directly.\n            - default using multi-kernel method.\n\n            '
        self.conn.send_request(request_type='feature', request_content={'instruments': instruments, 'fields': fields, 'start_time': start_time, 'end_time': end_time, 'freq': freq, 'disk_cache': 0}, msg_queue=self.queue)
        feature_uri = self.queue.get(timeout=C['timeout'])
        if isinstance(feature_uri, Exception):
            raise feature_uri
        else:
            instruments_d = self.get_instruments_d(instruments, freq)
            column_names = self.get_column_names(fields)
            cal = Cal.calendar(start_time, end_time, freq)
            if (len(cal) == 0):
                return pd.DataFrame(columns=column_names)
            start_time = cal[0]
            end_time = cal[(- 1)]
            data = self.dataset_processor(instruments_d, column_names, start_time, end_time, freq)
            if return_uri:
                return (data, feature_uri)
            else:
                return data
    else:
        '\n            Call the server to generate the data-set cache, get the uri of the cache file.\n            Then load the data from the file on NFS directly.\n            - using single-process implementation.\n\n            '
        self.conn.send_request(request_type='feature', request_content={'instruments': instruments, 'fields': fields, 'start_time': start_time, 'end_time': end_time, 'freq': freq, 'disk_cache': 1}, msg_queue=self.queue)
        feature_uri = self.queue.get(timeout=C['timeout'])
        if isinstance(feature_uri, Exception):
            raise feature_uri
        get_module_logger('data').debug('get result')
        try:
            mnt_feature_uri = os.path.join(C.mount_path, C.dataset_cache_dir_name, feature_uri)
            df = DiskDatasetCache.read_data_from_cache(mnt_feature_uri, start_time, end_time, fields)
            get_module_logger('data').debug('finish slicing data')
            if return_uri:
                return (df, feature_uri)
            return df
        except AttributeError:
            raise IOError('Unable to fetch instruments from remote server!')