当前位置: 首页>>代码示例>>C#>>正文


C# Scheduler.GetNodeList方法代码示例

本文整理汇总了C#中Scheduler.GetNodeList方法的典型用法代码示例。如果您正苦于以下问题:C# Scheduler.GetNodeList方法的具体用法?C# Scheduler.GetNodeList怎么用?C# Scheduler.GetNodeList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Scheduler的用法示例。


在下文中一共展示了Scheduler.GetNodeList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateClusterWorker

        private void UpdateClusterWorker(object newName) {
            try {
                string clusterName = (string)newName;
                List<string> groups = new List<string>();
                ISchedulerCollection nodes;

                try {
                    using (var scheduler = new Scheduler()) {
                        scheduler.Connect(clusterName);

                        nodes = scheduler.GetNodeList(null, null);

                        using (var store = SchedulerStore.Connect(clusterName)) {

                            foreach (var group in store.GetNodeGroups()) {
                                groups.Add(group.Name);
                            }
                        }
                    }
                } catch (SchedulerException) {
                    // unable to connect to the node.
                    return;
                }

                try {
                    this.BeginInvoke((Action)(() => {
                        _pickNodesCombo.SelectedIndexChanged -= PickNodesComboSelectedIndexChanged;
                        _pickNodesCombo.Items.Clear();
                        foreach (var group in groups) {
                            _pickNodesCombo.Items.Add(group);
                            if (group == _environment.PickNodesFrom || 
                                (String.IsNullOrWhiteSpace(_environment.PickNodesFrom) && group == "ComputeNodes")) {
                                _pickNodesCombo.SelectedIndex = _pickNodesCombo.Items.Count - 1;
                            }
                        }

                        if (_pickNodesCombo.SelectedIndex == -1) {
                            _pickNodesCombo.SelectedIndex = 0;
                        }
                        _pickNodesCombo.SelectedIndexChanged += PickNodesComboSelectedIndexChanged;

                        _nodesView.Items.Clear();
                        int totalCores = 0;
                        string[] selectedNodes = _environment.SelectedNodes;
                        foreach (ISchedulerNode node in nodes) {
                            if (!node.NodeGroups.Contains(_pickNodesCombo.Text)) {
                                continue;
                            }
                            totalCores += node.NumberOfCores;

                            var item = new ListViewItem(
                                new[] { 
                                node.Name,
                                node.CpuSpeed.ToString(),
                                node.MemorySize.ToString(),
                                node.NumberOfCores.ToString(),
                                node.State.ToString()
                            }
                            );

                            if (selectedNodes != null && selectedNodes.Contains(node.Name)) {
                                item.Checked = true;
                            }

                            _nodesView.Items.Add(item);
                        }

                        _numOfProcsCombo.Items.Clear();
                        _numOfProcsCombo.TextChanged -= NumOfProcsComboChanged;
                        for (int i = 0; i < totalCores; i++) {
                            _numOfProcsCombo.Items.Add(i + 1);
                            if (i == _environment.NumberOfProcesses - 1) {
                                _numOfProcsCombo.SelectedIndex = i;
                                _lastNumProcsValue = _numOfProcsCombo.Text;
                            }
                        }
                        _numOfProcsCombo.TextChanged += NumOfProcsComboChanged;
                    }));
                } catch (InvalidOperationException) {
                    // we could race here w/ the form being closed and the handle being disposed.
                }
                
            } catch (System.Net.Sockets.SocketException) {
            }
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:85,代码来源:ClusterSelector.cs


注:本文中的Scheduler.GetNodeList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。