Ejemplo n.º 1
0
        private static SessionStartInfo BuildSessionStartInfo(
            string server,
            string serviceName,
            string BindingScheme,
            string TraceDir,
            string username,
            string password,
            SessionUnitType unitType,
            int?minUnit,
            int?maxUnit,
            Version serviceVersion)
        {
            SessionStartInfo startInfo;

            if (serviceVersion == null)
            {
                startInfo = new SessionStartInfo(server, serviceName);
            }
            else
            {
                startInfo = new SessionStartInfo(server, serviceName, serviceVersion);
            }

            if (BindingScheme != null)
            {
                // If BindingScheme is assigned, using the scheme
                switch (BindingScheme.ToLower())
                {
                case "nettcp":
                case "http":
                case "webapi":
                    startInfo.TransportScheme = (TransportScheme)Enum.Parse(typeof(TransportScheme), BindingScheme, true);
                    break;

                default: break;
                }
            }

            if (InProc)
            {
                startInfo.UseInprocessBroker = true;
            }

            if (unitType != SessionUnitType.Core)
            {
                startInfo.SessionResourceUnitType = unitType;
            }

            startInfo.MaximumUnits = maxUnit;
            startInfo.MinimumUnits = minUnit;

            return(startInfo);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Helper method to convert between Excel-defined resource type and SOA-defined resource type
        /// </summary>
        /// <param name="type">Excel-defined enum specifying resource type</param>
        /// <returns>SOA-defined resource type</returns>
        private static Microsoft.Hpc.Scheduler.Session.SessionUnitType?ResourceToSessionUnitType(SessionUnitType type)
        {
            Microsoft.Hpc.Scheduler.Session.SessionUnitType?unitType = null;

            // Assign return value based on input
            switch (type)
            {
            case SessionUnitType.Core:
                unitType = Microsoft.Hpc.Scheduler.Session.SessionUnitType.Core;
                break;

            case SessionUnitType.Node:
                unitType = Microsoft.Hpc.Scheduler.Session.SessionUnitType.Node;
                break;

            case SessionUnitType.Socket:
                unitType = Microsoft.Hpc.Scheduler.Session.SessionUnitType.Socket;
                break;

            default:
                throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Resources.ExcelClient_InvalidResType, type), "type");
            }

            return(unitType);
        }