Esempio n. 1
0
        /// <summary>
        /// Attach to a existing session async with the session attach info and binding
        /// </summary>
        /// <param name="attachInfo">The attach info</param>
        /// <param name="binding">indicting the binding</param>
        /// <returns>A persistant session</returns>
        public static async Task <V3Session> AttachSessionAsync(SessionAttachInfo attachInfo, Binding binding)
        {
            Utility.ThrowIfNull(attachInfo, "attachInfo");

            if (Utility.IsHpcSessionType(attachInfo.GetType()))
            {
                Utility.ThrowIfEmpty(attachInfo.Headnode, "headNode");

                return((V3Session)await HpcSessionFactory.BuildSessionFactory(attachInfo).AttachSession(attachInfo, false, Timeout.Infinite, binding).ConfigureAwait(false));
            }
            else
            {
                throw new ArgumentException(SR.BackendNotSupported, "attachInfo");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Asynchronous mode of submitting a job and get a ServiceJobSession object.
        /// </summary>
        /// <param name="startInfo">The session start info for creating the service session</param>
        /// <param name="binding">indicting the binding</param>
        /// <returns>A service job session object, including the endpoint address and the two jobs related to this session</returns>
        public static async Task <V3Session> CreateSessionAsync(SessionStartInfo startInfo, Binding binding)
        {
            Utility.ThrowIfNull(startInfo, "startInfo");

            Utility.ThrowIfEmpty(startInfo.Headnode, "headNode");

            if (Utility.IsHpcSessionType(startInfo.GetType()))
            {
                return((V3Session)await HpcSessionFactory.BuildSessionFactory(startInfo).CreateSession(startInfo, false, Constant.DefaultCreateSessionTimeout, binding).ConfigureAwait(false));
            }
            else
            {
                throw new ArgumentException(SR.BackendNotSupported, "startInfo");
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Create a persistent session async
        /// </summary>
        /// <param name="startInfo">The session start info</param>
        /// <param name="binding">indicating the binding</param>
        /// <returns>A persistent session instance</returns>
        public static async Task <HpcDurableSession> CreateSessionAsync(SessionStartInfo startInfo, Binding binding)
        {
            Utility.ThrowIfNull(startInfo, "startInfo");

            if (Utility.IsHpcSessionType(startInfo.GetType()))
            {
                SessionStartInfo sessionStartInfo = startInfo;

                Utility.ThrowIfEmpty(sessionStartInfo.Headnode, "headNode");

                if (!sessionStartInfo.DebugModeEnabled && sessionStartInfo.UseInprocessBroker)
                {
                    throw new ArgumentException(SR.InprocessBroker_NotSupportDurableSession, "UseInprocessBroker");
                }

                return((HpcDurableSession)await HpcSessionFactory.BuildSessionFactory(startInfo).CreateSession(startInfo, true, Constant.DefaultCreateSessionTimeout, binding).ConfigureAwait(false));
            }
            else
            {
                throw new ArgumentException(SR.BackendNotSupported, "startInfo");
            }
        }