Exemple #1
0
        private void Init()
        {
            if (Credentials == null)
            {
                Credentials = new NodeCredentials(null, null, null);
            }

            if (SupportedArchitectures == null)
            {
                SupportedArchitectures = new string[0];
            }

            if (_packages == null)
            {
                _packages = new List <PackageOnNode>();
            }
            if (Packages == null)
            {
                Packages = new ReadOnlyCollection <PackageOnNode>(_packages);
            }

            if (_otherSoftware == null)
            {
                _otherSoftware = new List <string>();
            }
            if (OtherSoftware == null)
            {
                OtherSoftware = new ReadOnlyCollection <string>(_otherSoftware);
            }

            if (StaticHardwareParams == null)
            {
                StaticHardwareParams = new Dictionary <string, string>();
            }

            if (TasksSubmissionLimit == 0) // todo : ok?
            {
                TasksSubmissionLimit = 1;
            }
        }
Exemple #2
0
        private void Init()
        {
            if (Credentials == null)
                Credentials = new NodeCredentials(null, null, null);

            if (SupportedArchitectures == null)
                SupportedArchitectures = new string[0];

            if (_packages == null)
                _packages = new List<PackageOnNode>();
            if (Packages == null)
                Packages = new ReadOnlyCollection<PackageOnNode>(_packages);

            if (_otherSoftware == null)
                _otherSoftware = new List<string>();
            if (OtherSoftware == null)
                OtherSoftware = new ReadOnlyCollection<string>(_otherSoftware);

            if (StaticHardwareParams == null)
                StaticHardwareParams = new Dictionary<string, string>();

            if (TasksSubmissionLimit == 0) // todo : ok?
                TasksSubmissionLimit = 1;
        }
Exemple #3
0
        public void OverrideNulls(ResourceNode defaultValues)
        {
            Init();

            if (defaultValues == null)
            {
                CheckConsistency();
                return;
            }

            //ResourceName { get;  set; }   //  private set
            //public string ProviderName;

            if (!SupportedArchitectures.Any() && defaultValues.SupportedArchitectures.Any())
                SupportedArchitectures = defaultValues.SupportedArchitectures; // it's ok, because field is read-only

            if (Services == null)
                Services = new NodeServices(defaultValues.Services);

            if (DataFolders == null)
                DataFolders = new NodeDataFolders(defaultValues.DataFolders);

            Credentials = new NodeCredentials
            (
                userName: (Credentials.Username ?? defaultValues.Credentials.Username),
                password: (Credentials.Password ?? defaultValues.Credentials.Password),
                certFile: (Credentials.CertFile ?? defaultValues.Credentials.CertFile)
            );

            if (CoresCount == 0 && defaultValues.CoresCount > 0)
                CoresCount = defaultValues.CoresCount;

            //if (CoresAvailable == 0 && defaultValues.CoresAvailable > 0) // todo : unnecessary?
                //CoresAvailable = defaultValues.CoresAvailable;

            if (TasksSubmissionLimit <= 1 && defaultValues.TasksSubmissionLimit > 1) // do not override if defaultValue == (0 or 1) or non-default value for node is set
                TasksSubmissionLimit = defaultValues.TasksSubmissionLimit;

            //if (SubmissionsAvailable == 0 && defaultValues.SubmissionsAvailable > 0) // todo : unnecessary?
                //SubmissionsAvailable = defaultValues.SubmissionsAvailable;

            if (defaultValues.StaticHardwareParams != null)
                foreach (var key in defaultValues.StaticHardwareParams.Keys)
                {
                    if (!StaticHardwareParams.ContainsKey(key))
                        StaticHardwareParams[key] = defaultValues.StaticHardwareParams[key];
                }

            if (!_packages.Any())
            {
                foreach (var pack in defaultValues._packages)
                    _packages.Add(new PackageOnNode(pack));
            }

            if (!_otherSoftware.Any())
            {
                foreach (var soft in defaultValues._otherSoftware)
                    _otherSoftware.Add(soft);
            }

            CheckConsistency();
        }
Exemple #4
0
        public void OverrideNulls(ResourceNode defaultValues)
        {
            Init();

            if (defaultValues == null)
            {
                CheckConsistency();
                return;
            }

            //ResourceName { get;  set; }   //  private set
            //public string ProviderName;

            if (!SupportedArchitectures.Any() && defaultValues.SupportedArchitectures.Any())
            {
                SupportedArchitectures = defaultValues.SupportedArchitectures; // it's ok, because field is read-only
            }
            if (Services == null)
            {
                Services = new NodeServices(defaultValues.Services);
            }

            if (DataFolders == null)
            {
                DataFolders = new NodeDataFolders(defaultValues.DataFolders);
            }

            Credentials = new NodeCredentials
                          (
                userName: (Credentials.Username ?? defaultValues.Credentials.Username),
                password: (Credentials.Password ?? defaultValues.Credentials.Password),
                certFile: (Credentials.CertFile ?? defaultValues.Credentials.CertFile)
                          );

            if (CoresCount == 0 && defaultValues.CoresCount > 0)
            {
                CoresCount = defaultValues.CoresCount;
            }

            //if (CoresAvailable == 0 && defaultValues.CoresAvailable > 0) // todo : unnecessary?
            //CoresAvailable = defaultValues.CoresAvailable;

            if (TasksSubmissionLimit <= 1 && defaultValues.TasksSubmissionLimit > 1) // do not override if defaultValue == (0 or 1) or non-default value for node is set
            {
                TasksSubmissionLimit = defaultValues.TasksSubmissionLimit;
            }

            //if (SubmissionsAvailable == 0 && defaultValues.SubmissionsAvailable > 0) // todo : unnecessary?
            //SubmissionsAvailable = defaultValues.SubmissionsAvailable;

            if (defaultValues.StaticHardwareParams != null)
            {
                foreach (var key in defaultValues.StaticHardwareParams.Keys)
                {
                    if (!StaticHardwareParams.ContainsKey(key))
                    {
                        StaticHardwareParams[key] = defaultValues.StaticHardwareParams[key];
                    }
                }
            }

            if (!_packages.Any())
            {
                foreach (var pack in defaultValues._packages)
                {
                    _packages.Add(new PackageOnNode(pack));
                }
            }

            if (!_otherSoftware.Any())
            {
                foreach (var soft in defaultValues._otherSoftware)
                {
                    _otherSoftware.Add(soft);
                }
            }

            CheckConsistency();
        }