/// <summary> /// Retrieves the list of RIC chain configuration pieces from carbon dataframes. Will throw an exception if nothing at all is returned, because /// we don't want empty lists being uploaded to datascope as a result of a failure to retrieve the dataframe /// </summary> /// <param name="cc_"></param> /// <param name="forceRefresh_"></param> /// <returns></returns> public static async Task<IEnumerable<FutureChainSetup>> Read(CarbonClient cc_, bool forceRefresh_ = false) { if (_list != null && !forceRefresh_) return _list; var frame = await cc_.GetFrameAsync<int>(DF_MONIKER); if (frame == null) { SLog.log.Error(string.Format("Failed to retrieve dataframe from Carbon with moniker [{0}]", DF_MONIKER)); return null; } _list = frame.ToRecords<FutureChainSetup>().ToList(); if (!_list.Any()) { _list = null; throw new Exception(string.Format( "Could not retrieve dataframe [{0}] from carbon to configure lists of futures", DF_MONIKER)); } return _list; }
public async Task<DateTime[]> GetGmtDatesFromCarbon(CarbonClient client_) { var deedle = await client_.GetFrameAsync<int>(getDatesMoniker()); if (deedle == null) return null; var recs = deedle.ToRecords<DateWrapper>(); return _cache[TZ.GMT] = recs.Select(x => x.DateTime).ToArray(); }
public void ShouldReadFromCarbonFrame() { // var moniker = "symapp.roll.ctd.us.ty"; // var moniker = "symapp.events.gmtdts.1"; var moniker = "symapp.events.config"; using (var cc = new CarbonClient("PRD", useLocalIdsCache: true)) { var frame = cc.GetFrameAsync(moniker).Result; frame.Print(); } var frame2 = CarbonModel.RetrieveFrameFromCarbon<int>(moniker).Result; frame2.Print(); }