Ejemplo n.º 1
0
        public Stream GetJobResources()
        {
            int    page       = JobQueryParameters.GetPage(1);
            int    rpp        = JobQueryParameters.GetPageSize(1000);
            bool   verbose    = JobQueryParameters.GetVerbose(false);
            Guid   sessionID  = JobQueryParameters.GetSessionId();
            string simulation = JobQueryParameters.GetSimulationName();
            string state      = JobQueryParameters.GetState();
            string order      = JobQueryParameters.GetOrder();
            Guid   consumerID = JobQueryParameters.GetConsumerId();

            Debug.WriteLine(String.Format("get job resources {0},{1}", page, rpp), this.GetType().Name);
            List <Dictionary <string, Object> > jobs = null;

            try
            {
                jobs = DataMarshal.GetJobs(sessionID, simulation, consumerID, state, order, page, rpp, verbose);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(String.Format("EXCEPTION: {0}   {1}", ex, ex.Message), this.GetType().Name);
                Debug.WriteLine("Stack Trace: " + ex.StackTrace, this.GetType().Name);
                var detail = new ErrorDetail(
                    ErrorDetail.Codes.DATAFORMAT_ERROR,
                    "Get Jobs Query Failed\n\nMessage: " + ex.Message + "\n\n\nStack Trace: " + ex.StackTrace
                    );
                throw new WebFaultException <ErrorDetail>(detail, System.Net.HttpStatusCode.BadRequest);
            }
            string json = Newtonsoft.Json.JsonConvert.SerializeObject(jobs);

            return(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(json)));
        }
Ejemplo n.º 2
0
        public Stream GetJobResources()
        {
            int    page       = JobQueryParameters.GetPage(1);
            int    rpp        = JobQueryParameters.GetPageSize(1000);
            bool   verbose    = JobQueryParameters.GetVerbose(false);
            Guid   sessionID  = JobQueryParameters.GetSessionId();
            string simulation = JobQueryParameters.GetSimulationName();
            string state      = JobQueryParameters.GetState();
            Guid   consumerID = JobQueryParameters.GetConsumerId();

            Debug.WriteLine(String.Format("get job resources {0},{1}", page, rpp), this.GetType().Name);
            List <Dictionary <string, Object> > jobs = DataMarshal.GetJobs(sessionID, simulation, consumerID, state, page, rpp, verbose);
            string json = Newtonsoft.Json.JsonConvert.SerializeObject(jobs);

            return(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(json)));
        }
Ejemplo n.º 3
0
        public Stream GetConsumer(string consumerID)
        {
            int  page     = QueryParameters_GetPage(1);
            int  rpp      = QueryParameters_GetPageSize(1000);
            bool verbose  = QueryParameters_GetVerbose(false);
            Guid consumer = new Guid(consumerID);

            string json = "";

            string simulation = null;

            Debug.WriteLine(String.Format("get session {0} job resources {1},{2}", consumerID, page, rpp), this.GetType().Name);
            var jobs = DataMarshal.GetJobs(Guid.Empty, simulation, consumer, null, null, page, rpp, verbose);

            json = Newtonsoft.Json.JsonConvert.SerializeObject(jobs);
            return(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(json)));
        }
Ejemplo n.º 4
0
        public Stream GetSession(string sessionID)
        {
            int    page    = QueryParameters.GetPage(1);
            int    rpp     = QueryParameters.GetPageSize(1000);
            Guid   session = new Guid(sessionID);
            bool   verbose = QueryParameters.GetVerbose(false);
            bool   meta    = QueryParameters.GetMetaData(false);
            string json    = "";

            if (meta)
            {
                Debug.WriteLine(String.Format("get session {0} metadata", sessionID), this.GetType().Name);
                var sessionMeta = DataMarshal.GetSessionMeta(session);
                json = Newtonsoft.Json.JsonConvert.SerializeObject(sessionMeta);
                return(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(json)));
            }
            string simulation = null;

            Debug.WriteLine(String.Format("get session {0} job resources {1},{2}", sessionID, page, rpp), this.GetType().Name);
            var jobs = DataMarshal.GetJobs(session, simulation, Guid.Empty, null, page, rpp, verbose);

            json = Newtonsoft.Json.JsonConvert.SerializeObject(jobs);
            return(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(json)));
        }