Ejemplo n.º 1
0
        public List <Guid> GetSessionList()
        {
            int page = QueryParameters.GetPage(1);
            int rpp  = QueryParameters.GetPageSize(1000);

            return(DataMarshal.GetSessions(page, rpp));
        }
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();
            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.º 3
0
        public Stream GetJob(string id)
        {
            bool verbose = JobQueryParameters.GetVerbose(false);

            Debug.WriteLine("GET job: " + id, this.GetType().Name);

            int myid = Convert.ToInt32(id);
            Dictionary <string, Object> d;

            try
            {
                d = DataMarshal.GetJobDict(myid, 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,
                    "No Job.Id=" + id
                    );
                throw new WebFaultException <ErrorDetail>(detail, System.Net.HttpStatusCode.NotFound);
            }
            string json = Newtonsoft.Json.JsonConvert.SerializeObject(d);

            return(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(json)));
        }
Ejemplo n.º 4
0
        public void SessionCreateOrder()
        {
            int            rpp = 100;
            HashSet <Guid> s   = new HashSet <Guid>();

            for (int page = 1; page <= 10; page++)
            {
                List <Guid>          sessionList = DataMarshal.GetSessions(page, rpp);
                Turbine.Data.Session entity      = null;
                DateTime             dt          = DateTime.Now;

                foreach (Guid guid in sessionList)
                {
                    Assert.IsFalse(s.Contains <Guid>(guid));
                    s.Add(guid);
                    entity = DataMarshal.GetSessionMeta(guid);
                    Debug.WriteLine(entity.Id);
                    // test Create Timestamp
                    Assert.IsTrue(DateTime.Compare(dt, entity.Create) <= 0, "Session '" + guid + "'Out of Order");
                    dt = entity.Create;
                }

                Assert.IsTrue(sessionList.Count() == 100);
            }
        }
Ejemplo n.º 5
0
        public Data.Serialize.Consumer GetConsumer(string consumerID)
        {
            Guid guid = new Guid(consumerID);

            Debug.WriteLine(String.Format("GET consumer {0}", consumerID), this.GetType().Name);
            return(DataMarshal.GetConsumer(guid));
        }
Ejemplo n.º 6
0
        public Stream StartSessionGeneratorResults(string sessionid, string generatorid, string pagenum)
        {
            bool verbose  = JobQueryParameters.GetVerbose(false);
            int  page     = 0;
            int  sub_page = QueryParameters_GetPage(1);
            int  rpp      = QueryParameters_GetPageSize(1000);

            Int32.TryParse(pagenum, out page);

            Guid sessionGuid   = new Guid(sessionid);
            Guid generatorGuid = new Guid(generatorid);

            string json = "";

            List <Dictionary <string, object> > joblist = null;

            try
            {
                joblist = DataMarshal.GetGeneratorPage(generatorGuid, page, sub_page, rpp, verbose);
                json    = Newtonsoft.Json.JsonConvert.SerializeObject(joblist);
            }
            catch (Exception ex)
            {
                var msg = "Failed to get page: " + pagenum + ", UpdateException: "
                          + ex.Message + ", InnerException: " + ex.InnerException + ", StackTrace: " + ex.StackTrace.ToString();
                Debug.WriteLine(msg, "SessionResource.StartSessionGeneratorResults");
                var detail = new ErrorDetail(
                    ErrorDetail.Codes.DATAFORMAT_ERROR,
                    String.Format("Failed to get page")
                    );
                throw new WebFaultException <ErrorDetail>(detail, System.Net.HttpStatusCode.BadRequest);
            }

            return(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(json)));
        }
Ejemplo n.º 7
0
        public string DeleteSessionGeneratorResults(string sessionid, string generatorid)
        {
            Guid sessionGuid   = new Guid(sessionid);
            Guid generatorGuid = new Guid(generatorid);

            string output = "Failed to Delete Generator";

            try
            {
                output = DataMarshal.DeleteGenerator(generatorGuid) ? "Generator has been successfully deleted"
                    : output;
            }
            catch (Exception ex)
            {
                var msg = "Failed to Delete Generator: " + generatorid + ", UpdateException: "
                          + ex.Message + ", InnerException: " + ex.InnerException + ", StackTrace: " + ex.StackTrace.ToString();
                Debug.WriteLine(msg, "SessionResource.DeleteSessionGeneratorResults");
                var detail = new ErrorDetail(
                    ErrorDetail.Codes.DATAFORMAT_ERROR,
                    String.Format("Failed to Delete Generator")
                    );
                throw new WebFaultException <ErrorDetail>(detail, System.Net.HttpStatusCode.BadRequest);
            }

            return(output);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// GET: Returns resource representation of Simulation
        /// </summary>
        /// <param name="name">Simulation name</param>
        /// <returns>Get Version of Simulation</returns>
        public Simulation GetSimulation(string nameOrID)
        {
            Guid simulationid = Guid.Empty;
            bool isGuid       = Guid.TryParse(nameOrID, out simulationid);

            Debug.WriteLine("Find simulation: " + nameOrID, this.GetType().Name);
            Simulation sim = null;

            try
            {
                sim = DataMarshal.GetSimulation(nameOrID, isGuid);

                /*if (sim == null)
                 * {
                 *  var detail = new ErrorDetail(
                 *      ErrorDetail.Codes.DATAFORMAT_ERROR,
                 *      String.Format("simulation \"{0}\" does not exist", nameOrID)
                 *  );
                 *  throw new WebFaultException<ErrorDetail>(detail,
                 *      System.Net.HttpStatusCode.NotFound);
                 * }
                 * return sim;*/
            }
            catch (Exception ex)
            {
                Debug.WriteLine("No simulation " + nameOrID, this.GetType().Name);
                Debug.WriteLine(ex.ToString());
                var detail = new ErrorDetail(
                    ErrorDetail.Codes.DATAFORMAT_ERROR,
                    "No simulation " + nameOrID + ", traceback: " + ex.StackTrace.ToString()
                    );
                throw new WebFaultException <ErrorDetail>(detail, System.Net.HttpStatusCode.NotFound);
            }
            return(sim);
        }
Ejemplo n.º 9
0
        public Simulations GetSimulations()
        {
            bool verbose = QueryParameters_GetVerbose(false);

            Debug.WriteLine("get all simulations", this.GetType().Name);
            return(DataMarshal.GetSimulations(verbose));
        }
Ejemplo n.º 10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="name">Simulation Name</param>
        /// <param name="inputName">input Name</param>
        /// <returns>Contents of input file</returns>
        public Stream GetStagedInputFile(string nameOrID, string inputName)
        {
            Debug.WriteLine(String.Format("GetStagedInputFile: {0}/input/{1}", nameOrID, inputName), this.GetType().Name);
            //OutgoingWebResponseContext ctx = WebOperationContext.Current.OutgoingResponse;
            Guid simulationid = Guid.Empty;
            bool isGuid       = Guid.TryParse(nameOrID, out simulationid);

            var e = DataMarshal.GetStagedInputFile(nameOrID, inputName, isGuid);

            if (e == null)
            {
                var detail = new ErrorDetail(
                    ErrorDetail.Codes.DATAFORMAT_ERROR,
                    String.Format("simulation \"{0}\" input \"{1}\" does not exist", nameOrID, inputName)
                    );
                throw new WebFaultException <ErrorDetail>(detail,
                                                          System.Net.HttpStatusCode.NotFound);
            }
            if (e.Content == null)
            {
                return(new MemoryStream());
            }
            this.OutgoingWebResponseContext_ContentType = "text/plain";
            if (e.InputFileType != null)
            {
                this.OutgoingWebResponseContext_ContentType = e.InputFileType;
            }
            this.OutgoingWebResponseContext_StatusCode = System.Net.HttpStatusCode.OK;
            return(new MemoryStream(e.Content));
        }
Ejemplo n.º 11
0
        public Stream GetStagedInputFile(string name, string inputName)
        {
            OutgoingWebResponseContext ctx = WebOperationContext.Current.OutgoingResponse;
            var e = DataMarshal.GetStagedInputFile(name, inputName);

            if (e == null)
            {
                var detail = new ErrorDetail(
                    ErrorDetail.Codes.DATAFORMAT_ERROR,
                    String.Format("simulation \"{0}\" input \"{1}\" does not exist", name, inputName)
                    );
                throw new WebFaultException <ErrorDetail>(detail,
                                                          System.Net.HttpStatusCode.NotFound);
            }
            if (e.Content == null)
            {
                return(new MemoryStream());
            }
            ctx.ContentType = "text/plain";
            if (e.InputFileType != null && e.InputFileType.Type != null)
            {
                ctx.ContentType = e.InputFileType.Type;
            }
            ctx.StatusCode = System.Net.HttpStatusCode.OK;
            return(new MemoryStream(e.Content));
        }
Ejemplo n.º 12
0
        public void SessionPageLargeRppLast()
        {
            int         page        = -1;
            int         rpp         = 10000;
            List <Guid> sessionList = DataMarshal.GetSessions(page, rpp);

            Assert.IsTrue(sessionList.Count() == 1001, "Count was " + sessionList.Count());
        }
Ejemplo n.º 13
0
        public void SessionPageLargeRppZeroResults()
        {
            int         page        = 2;
            int         rpp         = 10000;
            List <Guid> sessionList = DataMarshal.GetSessions(page, rpp);

            Assert.IsTrue(sessionList.Count() == 0, "Count was " + sessionList.Count());
        }
Ejemplo n.º 14
0
        public List <Guid> GetSessionList()
        {
            int page = QueryParameters_GetPage(1);
            int rpp  = QueryParameters_GetPageSize(1000);

            Debug.WriteLine("GET Session List");
            return(DataMarshal.GetSessions(page, rpp));
        }
Ejemplo n.º 15
0
        public Stream GetJob(string id)
        {
            Debug.WriteLine("get simulations: " + id, this.GetType().Name);
            int myid = Convert.ToInt32(id);
            Dictionary <string, Object> d = DataMarshal.GetJobDict(myid, true);
            string json = Newtonsoft.Json.JsonConvert.SerializeObject(d);

            return(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(json)));
        }
Ejemplo n.º 16
0
        public List <Guid> GetConsumerList()
        {
            int    page   = QueryParameters_GetPage(1);
            int    rpp    = QueryParameters_GetPageSize(1000);
            string status = QueryParameters_GetData("up", "status");

            Debug.WriteLine("GET Consumer List");
            return(DataMarshal.GetConsumers(status, page, rpp));
        }
Ejemplo n.º 17
0
        public Stream GetDescription(string sessionID)
        {
            var sessionMeta = DataMarshal.GetSessionMeta(new Guid(sessionID));

            Debug.WriteLine("GetDescription: " + sessionMeta);
            string json = Newtonsoft.Json.JsonConvert.SerializeObject(sessionMeta.Descrption);

            return(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(json)));
        }
Ejemplo n.º 18
0
        /*
         * public int RequestFloor(System.IO.Stream data)
         * {
         *  int num = 0;
         *  bool success = false;
         *  string content = "";
         *  using (StreamReader sr = new StreamReader(data))
         *  {
         *      content = sr.ReadToEnd();
         *      //Dictionary<string, int> dict =
         *      //    Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, int>>(json);
         *      //dict.TryGetValue("floor", out num);
         *      success = Int32.TryParse(content, out num);
         *  }
         *  if (!success)
         *  {
         *      Debug.WriteLine("Failed to parse floor request: " + content, GetType());
         *      return 0;
         *  }
         *
         *  var accessor = GetConsumerResourceAccessor();
         *  accessor.SetConsumerConfigFloor(num);
         *
         *  return num;
         * }
         *
         * public Stream GetConsumerConfig()
         * {
         *  var accessor = GetConsumerResourceAccessor();
         *  Dictionary<string,Object> d = accessor.GetConsumerConfig();
         *  var json = Newtonsoft.Json.JsonConvert.SerializeObject(d);
         *  return new MemoryStream(System.Text.Encoding.UTF8.GetBytes(json));
         * }
         */

        public Stream GetConsumerLog(string consumerID)
        {
            Guid guid = new Guid(consumerID);

            Debug.WriteLine(String.Format("GET consumer log {0}", consumerID), this.GetType().Name);
            var consumer   = DataMarshal.GetConsumer(guid);
            var instanceID = consumer.instanceID;
            var accessor   = GetConsumerResourceAccessor();
            var builder    = new System.Text.StringBuilder();

            builder.AppendLine(String.Format("instanceID {0} {1} ", consumer.instanceID, consumer.status));
            accessor.GetConsumerLog(instanceID, builder);
            return(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(builder.ToString())));
        }
Ejemplo n.º 19
0
        public bool UpdateDescription(string sessionID, Stream data)
        {
            var content_type = WebOperationContext.Current.IncomingRequest.ContentType;

            byte[] bytes;
            using (var ms = new MemoryStream())
            {
                data.CopyTo(ms);
                bytes = ms.ToArray();
            }
            var s = System.Text.Encoding.UTF8.GetString(bytes);

            return(DataMarshal.UpdateDescription(sessionID, s));
        }
Ejemplo n.º 20
0
        public void SessionCreateOrderLastPage()
        {
            int         page        = -1;
            int         rpp         = 100;
            List <Guid> sessionList = DataMarshal.GetSessions(page, rpp);

            Assert.IsTrue(sessionList.Count() == 1, "Count was " + sessionList.Count());
            List <Guid> sessionList2 = DataMarshal.GetSessions(11, rpp);

            Assert.IsTrue(sessionList.Count() == 1);

            for (int i = 0; i < sessionList.Count(); i++)
            {
                Assert.AreEqual(sessionList.ElementAt <Guid>(i), sessionList2.ElementAt <Guid>(i));
            }
        }
Ejemplo n.º 21
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.º 22
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.º 23
0
        /// <summary>
        /// GET: Get Staged input names
        /// </summary>
        /// <param name="name">Simulation Name</param>
        /// <returns>Array of input names</returns>
        public string[] GetStagedInputs(string nameOrID)
        {
            Guid simulationid = Guid.Empty;
            bool isGuid       = Guid.TryParse(nameOrID, out simulationid);

            var stagedInputs = DataMarshal.GetStagedInputs(nameOrID, isGuid);

            if (stagedInputs == null)
            {
                var detail = new ErrorDetail(
                    ErrorDetail.Codes.DATAFORMAT_ERROR,
                    String.Format("simulation \"{0}\" does not exist", nameOrID)
                    );
                throw new WebFaultException <ErrorDetail>(detail,
                                                          System.Net.HttpStatusCode.NotFound);
            }
            return(stagedInputs);
        }
Ejemplo n.º 24
0
        public Simulation UpdateSimulation(string name, Simulation sim)
        {
            ISimulationProducerContract contract = null;

            if (sim == null)
            {
                string msg = String.Format("No Application specified in Simulation {0}", name);
                Debug.WriteLine(msg, this.GetType().Name);
                var detail = new ErrorDetail(
                    ErrorDetail.Codes.DATAFORMAT_ERROR,
                    msg
                    );
                throw new WebFaultException <ErrorDetail>(detail,
                                                          System.Net.HttpStatusCode.InternalServerError);
            }

            string appname = sim.Application;

            try
            {
                contract = Turbine.Lite.Web.Resources.Contracts.ProducerSimulationContract.Create(name, appname);
            }
            catch (Exception ex)
            {
                string msg = String.Format("Failed to Create Simulation {0}: {1} {2}",
                                           name, ex.Message, ex.StackTrace.ToString());
                if (ex.InnerException != null)
                {
                    msg += String.Format("    InnerException:    {0} {1}",
                                         ex.InnerException.Message, ex.InnerException.StackTrace.ToString());
                }
                Debug.WriteLine(msg, this.GetType().Name);
                var detail = new ErrorDetail(
                    ErrorDetail.Codes.DATAFORMAT_ERROR,
                    msg
                    );
                throw new WebFaultException <ErrorDetail>(detail,
                                                          System.Net.HttpStatusCode.InternalServerError);
            }

            sim = DataMarshal.GetSimulation(name);

            return(sim);
        }
Ejemplo n.º 25
0
        public Simulation GetSimulation(string name)
        {
            Debug.WriteLine("Find simulation: " + name, this.GetType().Name);
            Simulation sim = null;

            try
            {
                sim = DataMarshal.GetSimulation(name);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("No simulation " + name, this.GetType().Name);
                Debug.WriteLine(ex.ToString());
                var detail = new ErrorDetail(
                    ErrorDetail.Codes.DATAFORMAT_ERROR,
                    "No simulation " + name + ", traceback: " + ex.StackTrace.ToString()
                    );
                throw new WebFaultException <ErrorDetail>(detail, System.Net.HttpStatusCode.NotFound);
            }
            return(sim);
        }
Ejemplo n.º 26
0
        public int StopConsumer(string consumerID)
        {
            int  stopped = 0;
            Guid guid    = new Guid(consumerID);

            Debug.WriteLine(String.Format("Trying to stop consumer {0}", consumerID), this.GetType().Name);
            try
            {
                stopped = DataMarshal.StopConsumer(guid);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Failed to stop consumer with Id " + consumerID, this.GetType().Name);
                Debug.WriteLine(ex.ToString());
                var detail = new ErrorDetail(
                    ErrorDetail.Codes.DATAFORMAT_ERROR,
                    "Failed consumer with Id " + consumerID + ", traceback: " + ex.StackTrace.ToString()
                    );
                throw new WebFaultException <ErrorDetail>(detail, System.Net.HttpStatusCode.NotFound);
            }

            switch (stopped)
            {
            case -1:
                Debug.WriteLine("Consumer is already down", this.GetType().Name);
                break;

            case 0:
                Debug.WriteLine(String.Format("Failed to stop consumer {0}", consumerID), this.GetType().Name);
                break;

            default:
                Debug.WriteLine(String.Format("Succeeded to stop consumer {0}", consumerID), this.GetType().Name);
                break;
            }

            return(stopped);
        }
Ejemplo n.º 27
0
        public Consumer GetConsumerLog(string consumerID)
        {
            Consumer consumer = null;
            Guid     guid     = new Guid(consumerID);

            Debug.WriteLine(String.Format("GET consumer log {0}", consumerID), this.GetType().Name);
            try
            {
                consumer = DataMarshal.GetConsumer(guid);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("No consumer with Id " + consumerID, this.GetType().Name);
                Debug.WriteLine(ex.ToString());
                var detail = new ErrorDetail(
                    ErrorDetail.Codes.DATAFORMAT_ERROR,
                    "No consumer with Id " + consumerID + ", traceback: " + ex.StackTrace.ToString()
                    );
                throw new WebFaultException <ErrorDetail>(detail, System.Net.HttpStatusCode.NotFound);
            }

            return(consumer);
        }
Ejemplo n.º 28
0
        public Stream SubmitJob(string id)
        {
            Debug.WriteLine("submit job " + id, this.GetType().Name);
            int myid = Convert.ToInt32(id);
            IJobProducerContract contract = new AspenJobProducerContract(myid);

            try
            {
                contract.Submit();
            }
            catch (Exception ex)
            {
                var detail = new ErrorDetail(
                    ErrorDetail.Codes.DATAFORMAT_ERROR,
                    "Failed to Submit job " + id + ", traceback " + ex.StackTrace.ToString()
                    );
                throw new WebFaultException <ErrorDetail>(detail, System.Net.HttpStatusCode.BadRequest);
            }
            var d    = DataMarshal.GetJobDict(contract.Id, true);
            var json = Newtonsoft.Json.JsonConvert.SerializeObject(d);

            return(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(json)));
        }
Ejemplo n.º 29
0
        public Stream KillJob(string id)
        {
            Debug.WriteLine("kill job " + id, this.GetType().Name);
            int myid = Convert.ToInt32(id);
            IJobProducerContract contract = new ProducerJobContract(myid);

            try
            {
                contract.Kill();
            }
            catch (Exception ex)
            {
                var detail = new ErrorDetail(
                    ErrorDetail.Codes.JOB_STATE_ERROR,
                    "Failed to Kill job " + id + ", " + ex.Message
                    );
                throw new WebFaultException <ErrorDetail>(detail, System.Net.HttpStatusCode.BadRequest);
            }
            var d    = DataMarshal.GetJobDict(contract.Id, true);
            var json = Newtonsoft.Json.JsonConvert.SerializeObject(d);

            return(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(json)));
        }
Ejemplo n.º 30
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)));
        }