public EvaluatorDescriptorImpl(INodeDescriptor nodeDescriptor, EvaluatorType type, int megaBytes, int core) { _nodeDescriptor = nodeDescriptor; _type = type; _megaBytes = megaBytes; _virtualCore = core; }
/// <summary> /// Gets the instance configuration. /// </summary> /// <param name="nodeUniqueIdentifier">The node unique identifier.</param> /// <returns> /// <see cref="IInstanceConfiguration"/> instance provides configuration utilities. /// </returns> public IInstanceConfiguration GetInstanceConfiguration(INodeDescriptor nodeUniqueIdentifier) { if (Configuration == null) { return(null); } return(Configuration.GetInstanceConfiguration(nodeUniqueIdentifier)); }
internal EvaluatorDescriptorImpl(INodeDescriptor nodeDescriptor, EvaluatorType type, int megaBytes, int core, string rack = DefaultRackName) { _nodeDescriptor = nodeDescriptor; _evaluatorType = type; _megaBytes = megaBytes; _core = core; _rack = rack; }
// TODO[JIRA REEF-1054]: make runtimeName not optional internal EvaluatorDescriptorImpl(INodeDescriptor nodeDescriptor, EvaluatorType type, int megaBytes, int core, string rack = DefaultRackName, string runtimeName = "") { _nodeDescriptor = nodeDescriptor; _evaluatorType = type; _megaBytes = megaBytes; _core = core; _rack = rack; _runtimeName = runtimeName; }
/// <summary> /// Initializes a new instance of the <see cref="NodeDescriptorWrapper"/> class. /// </summary> /// <param name="descriptor">The descriptor of the node.</param> internal NodeDescriptorWrapper(INodeDescriptor descriptor) { if (descriptor.DataType != null) { this.DataType = new XmlQualifiedName(descriptor.DataType.Name, descriptor.DataType.Namespace); } this.NodeIdentifier = new XmlQualifiedName(descriptor.NodeIdentifier.Name, descriptor.NodeIdentifier.Namespace); this.NodeClass = descriptor.NodeClass; this.InstanceDeclaration = descriptor.InstanceDeclaration; }
public EvaluatorDescriptor( INodeDescriptor nodeDescriptor, int memory, int virtualCore, RuntimeName runtimeName = RuntimeName.Local) { NodeDescriptor = nodeDescriptor; Memory = memory; VirtualCore = virtualCore; RuntimeName = runtimeName; }
internal EvaluatorDescriptorImpl(INodeDescriptor nodeDescriptor, EvaluatorType type, int megaBytes, int core, string runtimeName, string rack = DefaultRackName) { _nodeDescriptor = nodeDescriptor; _evaluatorType = type; _megaBytes = megaBytes; _core = core; _rack = rack; if (!string.IsNullOrWhiteSpace(runtimeName) && !Enum.TryParse(runtimeName, true, out _runtimeName)) { throw new ArgumentException("Unknown runtime name received " + runtimeName); } }
protected override void UpdatePropertyGridSelectedObject(IModelNode imodelNode) { INodeDescriptor dscr = imodelNode.GetINodeDescriptor(); if (dscr == null) { this.PropertyGrid.SelectedObject = null; } else { this.PropertyGrid.SelectedObject = new InstanceConfigurationMasterEditor(SolutionTreeNode.SolutionRoot.GetInstanceConfiguration(dscr)); } }
/// <summary> /// Gets the instance configuration. /// </summary> /// <param name="nodeUniqueIdentifier">The node unique identifier.</param> /// <returns>The interface providing access to the instance configuration.</returns> internal IInstanceConfiguration GetInstanceConfiguration(INodeDescriptor nodeUniqueIdentifier) { InstanceConfiguration sourceIC = new InstanceConfiguration(nodeUniqueIdentifier); if (Dictionary.TryGetValue(sourceIC.NodeDescriptor, out InstanceConfiguration ic)) { return(ic); } else { Dictionary.Add(sourceIC.NodeDescriptor, sourceIC); return(sourceIC); } }
/// <summary> /// Gets the instance to be used by a user to configure the selected node. /// </summary> /// <param name="descriptor">Provides identifying description of the node to be configured.</param> /// <returns>Returned object provides access to the instance node configuration edition functionality.</returns> /// <exception cref="ArgumentNullException"></exception> public override IInstanceConfiguration GetInstanceConfiguration(INodeDescriptor descriptor) { if (descriptor == null) { throw new ArgumentNullException(nameof(descriptor)); } if (CurrentConfiguration == null) { return(null); } NodeDescriptorBase _nd = NodeDescriptorBase.Clone(descriptor); return(InstanceConfigurationFactory.GetIInstanceConfiguration(CurrentConfiguration.GetInstanceConfiguration(_nd), CurrentConfiguration.GetMessageHandlers(), TraceSource.TraceData, () => this.RaiseOnChangeEvent())); }
/// <summary> /// Creates the OPCDA client source configuration. /// </summary> /// <param name="item">The item.</param> /// <param name="LastResultInfo">The last result info.</param> /// <param name="SkipGetItemIdentifier">if set to <c>true</c> skip calling OPCDAClienteEntryPoint.GetItemIdentifier (OPCItemIdentifier==null) </param> public OPCDAClientSourceConfiguration( INodeDescriptor item, out ConfigurationManagement.AdditionalResultInfo LastResultInfo, bool SkipGetItemIdentifier) { LastResultInfo = ConfigurationManagement.AdditionalResultInfo.OK; OPCItemIdentifier ret = null; if (!SkipGetItemIdentifier) { ret = Main.EntryPoint.OPCDAClienteEntryPoint.GetItemIdentifier(item.BindingDescription, out LastResultInfo); } if (ret == null) { Selected = false; LastResultInfo = ConfigurationManagement.AdditionalResultInfo.Cancel; return; } ItemName = ret.ItemName; ServerName = ret.ServerName; SubscriptionName = ret.SubscriptionName; Selected = true; }
/// <summary> /// This method handles resource allocations by creating a new EvaluatorManager instance. /// </summary> /// <param name="resourceAllocationProto"></param> private void Handle(ResourceAllocationProto resourceAllocationProto) { lock (_evaluators) { try { INodeDescriptor nodeDescriptor = _resourceCatalog.GetNode(resourceAllocationProto.node_id); if (nodeDescriptor == null) { Exceptions.Throw(new InvalidOperationException("Unknown resurce: " + resourceAllocationProto.node_id), LOGGER); } EvaluatorDescriptorImpl evaluatorDescriptor = new EvaluatorDescriptorImpl(nodeDescriptor, EvaluatorType.UNDECIDED, resourceAllocationProto.resource_memory, resourceAllocationProto.virtual_cores); LOGGER.Log(Level.Info, "Resource allocation: new evaluator id: " + resourceAllocationProto.identifier); EvaluatorManager evaluatorManager = GetNewEvaluatorManagerInstance(resourceAllocationProto.identifier, evaluatorDescriptor); _evaluators.Add(resourceAllocationProto.identifier, evaluatorManager); } catch (Exception e) { Exceptions.Caught(e, Level.Error, LOGGER); Exceptions.Throw(new InvalidOperationException("Error handling resourceAllocationProto."), LOGGER); } } }
/// <summary> /// Constructor only to be used by the bridge. /// </summary> /// <param name="str"></param> public EvaluatorDescriptorImpl(string str) { var settings = new Dictionary<string, string>(); var components = str.Split(','); foreach (var component in components) { var pair = component.Trim().Split('='); if (pair == null || pair.Length != 2) { var e = new ArgumentException("invalid component to be used as key-value pair:", component); Exceptions.Throw(e, LOGGER); } settings.Add(pair[0], pair[1]); } string ipAddress; if (!settings.TryGetValue("IP", out ipAddress)) { Exceptions.Throw(new ArgumentException("cannot find IP entry"), LOGGER); } ipAddress = ipAddress.Split('/').Last(); string port; if (!settings.TryGetValue("Port", out port)) { Exceptions.Throw(new ArgumentException("cannot find Port entry"), LOGGER); } var portNumber = 0; int.TryParse(port, out portNumber); string hostName; if (!settings.TryGetValue("HostName", out hostName)) { Exceptions.Throw(new ArgumentException("cannot find HostName entry"), LOGGER); } string memory; if (!settings.TryGetValue("Memory", out memory)) { Exceptions.Throw(new ArgumentException("cannot find Memory entry"), LOGGER); } var memoryInMegaBytes = 0; int.TryParse(memory, out memoryInMegaBytes); string core; if (!settings.TryGetValue("Core", out core)) { Exceptions.Throw(new ArgumentException("cannot find Core entry"), LOGGER); } var vCore = 0; int.TryParse(core, out vCore); var ipEndPoint = new IPEndPoint(IPAddress.Parse(ipAddress), portNumber); _nodeDescriptor = new NodeDescriptorImpl { InetSocketAddress = ipEndPoint, HostName = hostName }; _evaluatorType = EvaluatorType.CLR; _megaBytes = memoryInMegaBytes; _core = vCore; }
/// <summary> /// Gets the instance configuration. /// </summary> /// <param name="nodeUniqueIdentifier">The node unique identifier.</param> /// <returns>The selected instance configuration interface to object providing configuration management functions.</returns> internal IInstanceConfiguration GetInstanceConfiguration(INodeDescriptor nodeUniqueIdentifier) { return(CASExtension.GetInstanceConfiguration(nodeUniqueIdentifier)); }
/// <summary> /// Gets the instance to be used by a user to configure the selected node. /// </summary> /// <param name="descriptor">Provides identifying description of the node to be configured.</param> /// <returns>Returned object provides access to the instance node configuration edition functionality.</returns> public abstract IInstanceConfiguration GetInstanceConfiguration(INodeDescriptor descriptor);
public void FromString(string str) { Dictionary <string, string> settings = new Dictionary <string, string>(); string[] components = str.Split(','); foreach (string component in components) { string[] pair = component.Trim().Split('='); if (pair == null || pair.Length != 2) { var e = new ArgumentException("invalid component to be used as key-value pair:", component); Exceptions.Throw(e, LOGGER); } settings.Add(pair[0], pair[1]); } string ipAddress; if (!settings.TryGetValue("IP", out ipAddress)) { Exceptions.Throw(new ArgumentException("cannot find IP entry"), LOGGER); } ipAddress = ipAddress.Split('/').Last(); string port; if (!settings.TryGetValue("Port", out port)) { Exceptions.Throw(new ArgumentException("cannot find Port entry"), LOGGER); } int portNumber = 0; int.TryParse(port, out portNumber); string hostName; if (!settings.TryGetValue("HostName", out hostName)) { Exceptions.Throw(new ArgumentException("cannot find HostName entry"), LOGGER); } string memory; if (!settings.TryGetValue("Memory", out memory)) { Exceptions.Throw(new ArgumentException("cannot find Memory entry"), LOGGER); } int memoryInMegaBytes = 0; int.TryParse(memory, out memoryInMegaBytes); string core; if (!settings.TryGetValue("Core", out core)) { Exceptions.Throw(new ArgumentException("cannot find Core entry"), LOGGER); } int vCore = 0; int.TryParse(core, out vCore); IPEndPoint ipEndPoint = new IPEndPoint(IPAddress.Parse(ipAddress), portNumber); _nodeDescriptor = new NodeDescriptorImpl(); _nodeDescriptor.InetSocketAddress = ipEndPoint; _nodeDescriptor.HostName = hostName; _type = EvaluatorType.CLR; _megaBytes = memoryInMegaBytes; _virtualCore = vCore; }
/// <summary> /// Gets the instance configuration. /// </summary> /// <param name="nodeUniqueIdentifier">The node unique identifier.</param> /// <returns>IInstanceConfiguration.</returns> internal IInstanceConfiguration GetInstanceConfiguration(INodeDescriptor nodeUniqueIdentifier) { return(Server.GetInstanceConfiguration(nodeUniqueIdentifier)); }
/// <summary> /// Initializes a new instance of the <see cref="InstanceConfiguration"/> class. /// </summary> /// <param name="nodeUniqueIdentifier">The node unique identifier.</param> internal InstanceConfiguration(INodeDescriptor nodeUniqueIdentifier) { NodeDescriptor = new NodeDescriptorWrapper(nodeUniqueIdentifier); }
/// <summary> /// Creates the instance configurations. /// </summary> /// <param name="descriptors">The descriptors.</param> /// <param name="SkipOpeningConfigurationFile">if set to <c>true</c> skip opening configuration file.</param> /// <param name="CancelWasPressed">The cancel was pressed.</param> public virtual void CreateInstanceConfigurations(INodeDescriptor[] descriptors, bool SkipOpeningConfigurationFile, Action<bool> CancelWasPressed) { throw new NotImplementedException("CreateInstanceConfigurations is not implemented yet"); //MessageBox.Show("CreateInstanceConfigurations is not implemented yet", "Library functionality", MessageBoxButton.OK, MessageBoxImage.Question); }
/// <summary> /// Gets the instance to be used by a user to configure the selected node. /// </summary> /// <param name="descriptor">Provides identifying description of the node to be configured.</param> /// <returns>Returned object provides access to the instance node configuration edition functionality.</returns> /// <exception cref="NotImplementedException"></exception> public override IInstanceConfiguration GetInstanceConfiguration(INodeDescriptor descriptor) { throw new NotImplementedException(); }
/// <summary> /// Constructor only to be used by the bridge. /// </summary> /// <param name="str"></param> public EvaluatorDescriptorImpl(string str) { var settings = new Dictionary <string, string>(); var components = str.Split(','); foreach (var component in components) { var pair = component.Trim().Split('='); if (pair == null || pair.Length != 2) { var e = new ArgumentException("invalid component to be used as key-value pair:", component); Exceptions.Throw(e, LOGGER); } settings.Add(pair[0], pair[1]); } // TODO[JIRA REEF-1054]: make runtimeName not optional string runtimeName; if (!settings.TryGetValue("RuntimeName", out runtimeName)) { Exceptions.Throw(new ArgumentException("cannot find RuntimeName entry"), LOGGER); } string ipAddress; if (!settings.TryGetValue("IP", out ipAddress)) { Exceptions.Throw(new ArgumentException("cannot find IP entry"), LOGGER); } ipAddress = ipAddress.Split('/').Last(); string port; if (!settings.TryGetValue("Port", out port)) { Exceptions.Throw(new ArgumentException("cannot find Port entry"), LOGGER); } var portNumber = 0; int.TryParse(port, out portNumber); string hostName; if (!settings.TryGetValue("HostName", out hostName)) { Exceptions.Throw(new ArgumentException("cannot find HostName entry"), LOGGER); } string memory; if (!settings.TryGetValue("Memory", out memory)) { Exceptions.Throw(new ArgumentException("cannot find Memory entry"), LOGGER); } var memoryInMegaBytes = 0; int.TryParse(memory, out memoryInMegaBytes); string core; if (!settings.TryGetValue("Core", out core)) { Exceptions.Throw(new ArgumentException("cannot find Core entry"), LOGGER); } var vCore = 0; int.TryParse(core, out vCore); var ipEndPoint = new IPEndPoint(IPAddress.Parse(ipAddress), portNumber); _nodeDescriptor = new NodeDescriptorImpl { InetSocketAddress = ipEndPoint, HostName = hostName }; _evaluatorType = EvaluatorType.CLR; _megaBytes = memoryInMegaBytes; _core = vCore; _runtimeName = runtimeName; }