public virtual void VerifyHsJobConfXML(NodeList nodes, Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job
                                        job)
 {
     NUnit.Framework.Assert.AreEqual("incorrect number of elements", 1, nodes.GetLength
                                         ());
     for (int i = 0; i < nodes.GetLength(); i++)
     {
         Element element = (Element)nodes.Item(i);
         WebServicesTestUtils.CheckStringMatch("path", job.GetConfFile().ToString(), WebServicesTestUtils
                                               .GetXmlString(element, "path"));
         // just do simple verification of fields - not data is correct
         // in the fields
         NodeList properties = element.GetElementsByTagName("property");
         for (int j = 0; j < properties.GetLength(); j++)
         {
             Element property = (Element)properties.Item(j);
             NUnit.Framework.Assert.IsNotNull("should have counters in the web service info",
                                              property);
             string name  = WebServicesTestUtils.GetXmlString(property, "name");
             string value = WebServicesTestUtils.GetXmlString(property, "value");
             NUnit.Framework.Assert.IsTrue("name not set", (name != null && !name.IsEmpty()));
             NUnit.Framework.Assert.IsTrue("name not set", (value != null && !value.IsEmpty())
                                           );
         }
     }
 }
Beispiel #2
0
        /*
         * (non-Javadoc)
         * @see org.apache.hadoop.yarn.webapp.view.HtmlBlock#render(org.apache.hadoop.yarn.webapp.view.HtmlBlock.Block)
         */
        protected override void Render(HtmlBlock.Block html)
        {
            string jid = $(AMParams.JobId);

            if (jid.IsEmpty())
            {
                html.P().("Sorry, can't do anything without a JobID.").();
                return;
            }
            JobId jobID = MRApps.ToJobID(jid);

            Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job job = appContext.GetJob(jobID);
            if (job == null)
            {
                html.P().("Sorry, ", jid, " not found.").();
                return;
            }
            Path confPath = job.GetConfFile();

            try
            {
                ConfInfo info = new ConfInfo(job);
                html.Div().H3(confPath.ToString()).();
                Hamlet.TBODY <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > tbody = html
                                                                                                   .Table("#conf").Thead().Tr().Th(JQueryUI.Th, "key").Th(JQueryUI.Th, "value").Th(
                    JQueryUI.Th, "source chain").().().Tbody();
                // Tasks table
                foreach (ConfEntryInfo entry in info.GetProperties())
                {
                    StringBuilder buffer  = new StringBuilder();
                    string[]      sources = entry.GetSource();
                    //Skip the last entry, because it is always the same HDFS file, and
                    // output them in reverse order so most recent is output first
                    bool first = true;
                    for (int i = (sources.Length - 2); i >= 0; i--)
                    {
                        if (!first)
                        {
                            // \u2B05 is an arrow <--
                            buffer.Append(" \u2B05 ");
                        }
                        first = false;
                        buffer.Append(sources[i]);
                    }
                    tbody.Tr().Td(entry.GetName()).Td(entry.GetValue()).Td(buffer.ToString()).();
                }
                tbody.().Tfoot().Tr().Th().Input("search_init").$type(HamletSpec.InputType.text).
                $name("key").$value("key").().().Th().Input("search_init").$type(HamletSpec.InputType
                                                                                 .text).$name("value").$value("value").().().Th().Input("search_init").$type(HamletSpec.InputType
                                                                                                                                                             .text).$name("source chain").$value("source chain").().().().().();
            }
            catch (IOException e)
            {
                Log.Error("Error while reading " + confPath, e);
                html.P().("Sorry got an error while reading conf file. ", confPath);
            }
        }
Beispiel #3
0
        /// <exception cref="System.IO.IOException"/>
        public ConfInfo(Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job job)
        {
            this.property = new AList <ConfEntryInfo>();
            Configuration jobConf = job.LoadConfFile();

            this.path = job.GetConfFile().ToString();
            foreach (KeyValuePair <string, string> entry in jobConf)
            {
                this.property.AddItem(new ConfEntryInfo(entry.Key, entry.Value, jobConf.GetPropertySources
                                                            (entry.Key)));
            }
        }
        /// <exception cref="Org.Codehaus.Jettison.Json.JSONException"/>
        public virtual void VerifyHsJobConf(JSONObject info, Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job
                                            job)
        {
            NUnit.Framework.Assert.AreEqual("incorrect number of elements", 2, info.Length());
            WebServicesTestUtils.CheckStringMatch("path", job.GetConfFile().ToString(), info.
                                                  GetString("path"));
            // just do simple verification of fields - not data is correct
            // in the fields
            JSONArray properties = info.GetJSONArray("property");

            for (int i = 0; i < properties.Length(); i++)
            {
                JSONObject prop  = properties.GetJSONObject(i);
                string     name  = prop.GetString("name");
                string     value = prop.GetString("value");
                NUnit.Framework.Assert.IsTrue("name not set", (name != null && !name.IsEmpty()));
                NUnit.Framework.Assert.IsTrue("value not set", (value != null && !value.IsEmpty()
                                                                ));
            }
        }