public override void DumpTreeRecursively(PrintWriter @out, StringBuilder prefix, int snapshot) { base.DumpTreeRecursively(@out, prefix, snapshot); @out.Write(", childrenSize=" + GetChildrenList(snapshot).Size()); DirectoryWithQuotaFeature q = GetDirectoryWithQuotaFeature(); if (q != null) { @out.Write(", " + q); } if (this is Snapshot.Root) { @out.Write(", snapshotId=" + snapshot); } @out.WriteLine(); if (prefix.Length >= 2) { prefix.Length = prefix.Length - 2; prefix.Append(" "); } DumpTreeRecursively(@out, prefix, new _IEnumerable_874(this, snapshot)); DirectorySnapshottableFeature s = GetDirectorySnapshottableFeature(); if (s != null) { s.DumpTreeRecursively(this, @out, prefix, snapshot); } }
/// <summary>Close the visitor</summary> /// <exception cref="System.IO.IOException"/> public virtual void Close(Exception error) { @out.Write(GetStatisticsString()); if (error != null) { @out.Write("EXITING ON ERROR: " + error.ToString() + "\n"); } @out.Close(); }
private void PrintHeader(PrintWriter @out, string nodeName) { @out.Write("<html><head>"); @out.Printf("<title>%s Reconfiguration Utility</title>%n", StringEscapeUtils.EscapeHtml (nodeName)); @out.Write("</head><body>\n"); @out.Printf("<h1>%s Reconfiguration Utility</h1>%n", StringEscapeUtils.EscapeHtml (nodeName)); }
internal virtual void Echo(int indent, params object[] args) { string prev = null; foreach (object o in args) { string s = o.ToString(); if (!s.IsEmpty() && !s.Equals("\n") && (prev == null || prev.EndsWith("\n"))) { Indent(indent); } prev = s; @out.Write(s); bytes += s.Length; } }
public virtual void TestGetClusterNodeLabelsWithLocalAccess() { YarnClient client = Org.Mockito.Mockito.Mock <YarnClient>(); Org.Mockito.Mockito.When(client.GetClusterNodeLabels()).ThenReturn(ImmutableSet.Of ("remote1", "remote2")); ClusterCLI cli = new ClusterCLI(); cli.SetClient(client); cli.SetSysOutPrintStream(sysOut); cli.SetSysErrPrintStream(sysErr); ClusterCLI.localNodeLabelsManager = Org.Mockito.Mockito.Mock <CommonNodeLabelsManager >(); Org.Mockito.Mockito.When(ClusterCLI.localNodeLabelsManager.GetClusterNodeLabels() ).ThenReturn(ImmutableSet.Of("local1", "local2")); int rc = cli.Run(new string[] { ClusterCLI.Cmd, "-" + ClusterCLI.ListLabelsCmd, "-" + ClusterCLI.DirectlyAccessNodeLabelStore }); NUnit.Framework.Assert.AreEqual(0, rc); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintWriter pw = new PrintWriter(baos); // it should return local* instead of remote* pw.Write("Node Labels: local1,local2"); pw.Close(); Org.Mockito.Mockito.Verify(sysOut).WriteLine(baos.ToString("UTF-8")); }
/// <exception cref="System.Exception"/> public override void TestFailure(Failure failure) { if (failure != null && failure.GetMessage() != null && failure.GetMessage().StartsWith (TestTimedOutPrefix)) { output.WriteLine("====> TEST TIMED OUT. PRINTING THREAD DUMP. <===="); output.WriteLine(); output.Write(BuildThreadDiagnosticString()); } }
/// <exception cref="System.Exception"/> public virtual void TestDSShellWithCustomLogPropertyFile() { FilePath basedir = new FilePath("target", typeof(TestDistributedShell).FullName); FilePath tmpDir = new FilePath(basedir, "tmpDir"); tmpDir.Mkdirs(); FilePath customLogProperty = new FilePath(tmpDir, "custom_log4j.properties"); if (customLogProperty.Exists()) { customLogProperty.Delete(); } if (!customLogProperty.CreateNewFile()) { NUnit.Framework.Assert.Fail("Can not create custom log4j property file."); } PrintWriter fileWriter = new PrintWriter(customLogProperty); // set the output to DEBUG level fileWriter.Write("log4j.rootLogger=debug,stdout"); fileWriter.Close(); string[] args = new string[] { "--jar", AppmasterJar, "--num_containers", "3", "--shell_command" , "echo", "--shell_args", "HADOOP", "--log_properties", customLogProperty.GetAbsolutePath (), "--master_memory", "512", "--master_vcores", "2", "--container_memory", "128" , "--container_vcores", "1" }; //Before run the DS, the default the log level is INFO Log LOG_Client = LogFactory.GetLog(typeof(Org.Apache.Hadoop.Yarn.Applications.Distributedshell.Client )); NUnit.Framework.Assert.IsTrue(LOG_Client.IsInfoEnabled()); NUnit.Framework.Assert.IsFalse(LOG_Client.IsDebugEnabled()); Log LogAm = LogFactory.GetLog(typeof(ApplicationMaster)); NUnit.Framework.Assert.IsTrue(LogAm.IsInfoEnabled()); NUnit.Framework.Assert.IsFalse(LogAm.IsDebugEnabled()); Log.Info("Initializing DS Client"); Org.Apache.Hadoop.Yarn.Applications.Distributedshell.Client client = new Org.Apache.Hadoop.Yarn.Applications.Distributedshell.Client (new Configuration(yarnCluster.GetConfig())); bool initSuccess = client.Init(args); NUnit.Framework.Assert.IsTrue(initSuccess); Log.Info("Running DS Client"); bool result = client.Run(); Log.Info("Client run completed. Result=" + result); NUnit.Framework.Assert.IsTrue(VerifyContainerLog(3, null, true, "DEBUG") > 10); //After DS is finished, the log level should be DEBUG NUnit.Framework.Assert.IsTrue(LOG_Client.IsInfoEnabled()); NUnit.Framework.Assert.IsTrue(LOG_Client.IsDebugEnabled()); NUnit.Framework.Assert.IsTrue(LogAm.IsInfoEnabled()); NUnit.Framework.Assert.IsTrue(LogAm.IsDebugEnabled()); }