Exemple #1
0
        public async Task <string> CreateHiveJob(string query, IEnumerable <string> resources, IDictionary <string, string> parameters, string jobFolder)
        {
            Contract.AssertArgNotNullOrEmpty(query, "query");
            Contract.AssertArgNotNull(resources, "resources");
            Contract.AssertArgNotNull(parameters, "parameters");
            Contract.AssertArgNotNullOrEmpty(jobFolder, jobFolder);

            var request = await hCatClient.CreateHiveJob(query, resources, parameters, jobFolder, callback : null);

            if (!request.IsSuccessStatusCode)
            {
                throw new HttpResponseException(request);
            }

            try
            {
                return(await GetJobIdFromServerResponse(request.Content));
            }
            catch (HttpParseException)
            {
                //502: The server, while acting as a gateway or proxy, received an invalid response from the upstream server.
                //This is caught and logged upstream.
                throw new HttpResponseException(HttpStatusCode.BadGateway);
            }
        }
Exemple #2
0
        internal string GetOutputFolderUri(string asvPath)
        {
            Contract.AssertArgNotNullOrEmpty(asvPath, "asvPath");
            Uri asvUri;

            if (Uri.TryCreate(asvPath, UriKind.Absolute, out asvUri))
            {
                //only parse the string/uri if its asv, otherwise fall through and reutrn an argument exception.
                if (asvUri.Scheme.ToLowerInvariant() == "asv")
                {
                    return(string.Format("https://{0}/{1}{2}", asvUri.Host, asvUri.UserInfo, asvUri.LocalPath));
                }
            }
            throw new ArgumentException();
        }
Exemple #3
0
        public async Task <JobDetails> GetJob(string jobId)
        {
            Contract.AssertArgNotNullOrEmpty(jobId, "jobId");

            var request = await hCatClient.GetJob(jobId);

            if (!request.IsSuccessStatusCode)
            {
                throw new HttpResponseException(request);
            }

            try
            {
                return(await GetJobDetailsFromServerResponse(request.Content));
            }
            catch (HttpParseException)
            {
                //502: The server, while acting as a gateway or proxy, received an invalid response from the upstream server.
                //This is caught and logged upstream.
                throw new HttpResponseException(HttpStatusCode.BadGateway);
            }
        }
 /// <summary>
 /// Ctor.
 /// </summary>
 public JobDetailsPassthroughAction(string jobId, DataAccess.Context.ClusterContainer container, string subscriptionId)
     : base(container, subscriptionId)
 {
     Contract.AssertArgNotNullOrEmpty(jobId, "jobId");
     this.jobId = jobId;
 }