/// <summary> /// Get the significant details of what needs approval /// </summary> /// <returns>A list of strings</returns> public override IDictionary <string, string> SignificantDetails() { IDictionary <string, string> returnList = base.SignificantDetails(); returnList.Add("Temperature", TemperatureCoefficient.ToString()); returnList.Add("Pressure", PressureCoefficient.ToString()); returnList.Add("Biome", BaseBiome.ToString()); returnList.Add("Hemisphere", Hemisphere.ToString()); return(returnList); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { string inputJson = null; var probes = new List <string>(); var cpus = 4; var dependentOn = "Probe"; var overrides = ""; var create = false; if (!DA.GetData(0, ref inputJson)) { return; } if (inputJson == "error") { return; } if (!DA.GetDataList(1, probes)) { return; } DA.GetData(2, ref cpus); DA.GetData(3, ref dependentOn); DA.GetData(4, ref overrides); DA.GetData(5, ref create); // Get Cache to see if we already did this var cacheKey = string.Join("", probes) + dependentOn + inputJson + overrides; var cachedValues = StringCache.getCache(cacheKey); DA.DisableGapLogic(); if (cachedValues == null || create) { const string queueName = "pressureCoefficients"; // Get queue lock var queueLock = StringCache.getCache(queueName); if (queueLock != "true") { StringCache.setCache(queueName, "true"); StringCache.setCache(InstanceGuid.ToString(), ""); StringCache.setCache(cacheKey, null); QueueManager.addToQueue(queueName, () => { try { cachedValues = PressureCoefficient.CreatePressureCoefficientTask( inputJson, probes, ComponentUtils.ValidateCPUs(cpus), dependentOn, overrides, create ); StringCache.setCache(cacheKey, cachedValues); if (create) { StringCache.setCache(cacheKey + "create", "true"); } } catch (NoObjectFoundException) { StringCache.setCache(cacheKey + "create", ""); } catch (Exception e) { StringCache.AppendCache(InstanceGuid.ToString(), e.Message + "\n"); StringCache.setCache(cacheKey, "error"); StringCache.setCache(cacheKey + "create", ""); } ExpireSolutionThreadSafe(true); Thread.Sleep(2000); StringCache.setCache(queueName, ""); }); } } HandleErrors(); Message = ""; // Read from Cache if (cachedValues != null) { DA.SetData(0, cachedValues); if (StringCache.getCache(cacheKey + "create") == "true") { Message = "Task Created"; } } }