def put_data(key, data, label="Python data", data_type=None): if data_type is None: data, data_type = _get_data_type(data) status = gateway.data_status(key, data_type, label) data_dict[key] = {'data': data, 'status': status} gateway.notify_data_updated(key, status)
def put_data(key, data, label="Python data", data_type=None): if data_type is None: data_type = _get_data_type(data) status = gateway.data_status(key, data_type, label) data_dict[key] = { 'data': _generate_matplotlib_data(data) if data_type == 'image' else data, 'status': status } gateway.notify_data_updated(key, status)
def write_data(key, path): data_info = get_data_info(key) if not data_info: return None if isinstance(data_info['data'], pd.DataFrame): _write_dataframe(data_info['data'], path) gateway.update_context_type(data_info['status'], path) elif psdf and isinstance(data_info['data'], psdf.DataFrame): dataframe = data_info['data'].toPandas() _write_dataframe(dataframe, path) gateway.update_context_type(data_info['status'], path) else: KVStoreClient.set(key, data_info['data']) gateway.update_context_type(data_info['status'], path, 'kv_store') gateway.notify_data_updated(key, data_info['status']) data_info['data'] = None # Delete data from data dictionary after write return data_info['status'].toJson()