本文整理汇总了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) {
}
}