/// <summary>
 /// Registers a new executor with the manager
 /// </summary>
 /// <param name="sc">security credentials used to perform this operation.</param>
 /// <param name="info">information about the executor (see ExecutorInfo)</param>
 /// <returns></returns>
 public string RegisterNew(SecurityCredentials sc, ExecutorInfo info)
 {
     return RegisterNew(sc, null, info);
 }
Exemple #2
0
        //-----------------------------------------------------------------------------------------------
        /// <summary>
        /// Register a new executor with this manager
        /// </summary>
        /// <param name="sc">security credentials to verify if the executor has permission to perform this operation 
        /// (i.e register executor, which is associated with the ExecuteThread permission)</param>
        /// <param name="info">executor information</param>
        /// <returns>the id of the executor registered</returns>
        public string Executor_RegisterNewExecutor(SecurityCredentials sc, string existingExecutorId, ExecutorInfo info)
        {
            AuthenticateUser(sc);
            EnsurePermission(sc, Permission.ExecuteThread);

            //logger.Debug("Registering new executor");
            return _Executors.RegisterNew(sc, existingExecutorId, info);
        }
        /// <summary>
        /// Registers a new executor with the manager
        /// </summary>
        /// <param name="sc">security credentials used to perform this operation.</param>
        /// <param name="executorId">The preferred executor ID. Set it to null to generate a new ID.</param>
        /// <param name="info">information about the executor (see ExecutorInfo)</param>
        /// <returns></returns>
        public string RegisterNew(SecurityCredentials sc, string executorId, ExecutorInfo info)
        {
            //NOTE: when registering, all executors are initially set to non-dedicated.non-connected.
            //once they connect and can be pinged back, then these values are set accordingly.
            ExecutorStorageView executorStorage = new ExecutorStorageView(
                executorId,
                false,
                false,
                info.Hostname,
                sc.Username,
                info.MaxCpuPower,
                info.MaxMemory,
                info.MaxDiskSpace,
                info.NumberOfCpus,
                info.OS,
                info.Architecture
                );

            if (this[executorId].VerifyExists())
            {
                // executor already exists, just update the details
                ManagerStorageFactory.ManagerStorage().UpdateExecutor(executorStorage);

                logger.Debug("Updated executor details = " + executorId);

                return executorId;
            }
            else
            {
                string newExecutorId = ManagerStorageFactory.ManagerStorage().AddExecutor(executorStorage);

                logger.Debug("Registered new executor id=" + newExecutorId);

                return newExecutorId;
            }
        }