Пример #1
0
        /// <summary>
        /// Open an existing DataClient with the specified ID, job ID and job secret
        /// </summary>
        /// <param name="hpcContext">The <see cref="IHpcContext"/> instance.</param>
        /// <param name="dataClientId">ID of the DataClient to be opened</param>
        /// <param name="jobId">Job ID</param>
        /// <param name="jobSecret">Job Secret</param>
        /// <returns>DataClient instance that provides read/write access to the specified DataClient</returns>
        internal static DataClient Open(string dataClientId, int jobId, string jobSecret)
        {
            var context = HpcContext.GetOrAdd(EndpointsConnectionString.LoadFromEnvVarsOrWindowsRegistry(), CancellationToken.None, true);

            Utility.ValidateDataClientId(dataClientId);
            DataClientInfo info = OpenBySecretInternal(context, dataClientId, jobId, jobSecret);

            return(new DataClient(context.ResolveSessionLauncherNodeAsync().GetAwaiter().GetResult(), dataClientId, info.PrimaryDataPath, true, TransportScheme.NetTcp, null, null));
        }
Пример #2
0
        /// <summary>
        ///     Get the hpc context which maps to the connection string.
        /// </summary>
        /// <param name="connectionString">the connection string instance</param>
        /// <returns></returns>
        public static ITelepathyContext GetOrAdd(EndpointsConnectionString connectionString)
        {
            if (!connectionString.IsGateway)
            {
                return(SoaContext.Default);
            }

            return(new SoaContext(connectionString));
        }
Пример #3
0
        /// <summary>
        /// Get the service info from registry (x64 boot) or info file (x86 boot)
        /// </summary>
        static string GetServiceInfo(string serviceConfigFileName)
        {
            string serviceConfigFile = string.Empty;

            try
            {
                //TODO get headnode
                string headnode;
                if (ServiceHostRuntimeConfiguration.Standalone)
                {
                    headnode = System.Net.Dns.GetHostName();
                }
                else
                {
                    headnode = EndpointsConnectionString.LoadFromEnvVarsOrWindowsRegistry().ConnectionString;
                }
                Debug.WriteLine($"[{nameof(GetServiceInfo)}](Debug) headnode: {headnode}.");
                Debug.Assert(!string.IsNullOrEmpty(headnode), "Head node connection string is null or empty.");
                ServiceRegistrationRepo serviceRegistration = new ServiceRegistrationRepo(Environment.GetEnvironmentVariable(Constant.RegistryPathEnv), null);

                // Get the path to the service config file name
                serviceConfigFile = serviceRegistration.GetServiceRegistrationPath(serviceConfigFileName);

                if (serviceConfigFile == null)
                {
                    // Make a part for the error message
                    string CentrialPath = serviceRegistration.CentrialPath;

                    StringBuilder serviceRegDirsBuilder = new StringBuilder();
                    if (!string.IsNullOrEmpty(CentrialPath))
                    {
                        serviceRegDirsBuilder.Append("\n\t");
                        serviceRegDirsBuilder.Append(CentrialPath);
                    }

                    serviceRegDirsBuilder.Append("\n");

                    Console.Error.WriteLine(
                        string.Format(
                            CultureInfo.CurrentCulture,
                            StringTable.CantFindServiceRegistrationFileUnderFolders,
                            serviceRegDirsBuilder.ToString()));
                }
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(
                    string.Format(CultureInfo.CurrentCulture, StringTable.ExceptionInReadingRegistrationFile, serviceConfigFile, e.ToString()));
            }

            return(serviceConfigFile);
        }
 public SoaFabricContext(EndpointsConnectionString connectionString)
 {
     this.ConnectionString = connectionString;
 }
 public SoaFabricContext()
 {
     this.ConnectionString = EndpointsConnectionString.ParseConnectionString(LocalHost);
 }
 public SoaFabricContext(string connectionString)
     : this(EndpointsConnectionString.ParseConnectionString(connectionString))
 {
 }
Пример #7
0
 public SoaContext(EndpointsConnectionString connectionString)
 {
     this.FabricContext = new SoaFabricContext(connectionString);
 }
Пример #8
0
 public static ITelepathyContext GetOrAdd(string connectionString)
 {
     return(GetOrAdd(EndpointsConnectionString.ParseConnectionString(connectionString)));
 }