add --debug-check commandline option

broken
Harald Wolff 2019-07-08 13:14:49 +02:00
parent 21274ecd0d
commit 9e548ff7cc
1 changed files with 37 additions and 0 deletions

View File

@ -13,6 +13,9 @@ using ln.skyscanner.checks;
using System.Collections.Generic;
using ln.skyscanner.import.skytron;
using System.Linq;
using ln.skyscanner.entities;
using ln.types.json;
using Newtonsoft.Json.Linq;
namespace ln.skyscanner
{
[JsonConverter(typeof(StringEnumConverter))]
@ -52,6 +55,7 @@ namespace ln.skyscanner
String skytronImport = null;
String benchMark = null;
String debugCheckNode = null;
Queue<string> qArguments = new Queue<string>(Arguments);
while (qArguments.Count > 0)
@ -68,6 +72,9 @@ namespace ln.skyscanner
case "--benchmark":
benchMark = qArguments.Dequeue();
break;
case "--debug-check":
debugCheckNode = qArguments.Dequeue();
break;
}
}
@ -94,6 +101,13 @@ namespace ln.skyscanner
throw new Exception("Quitting after benchmarking");
}
if (debugCheckNode != null)
{
DebugCheck(debugCheckNode);
throw new Exception("Qutting after --debug-check");
}
}
private SkyScanner()
{
@ -230,5 +244,28 @@ namespace ln.skyscanner
}
public void DebugCheck(String uniqueID)
{
Logger.ConsoleLogger.MaxLogLevel = LogLevel.DEBUGFULL;
Node node = Entities.NodeCollection.Query("uniqueIdentity", uniqueID).FirstOrDefault();
if (node == null)
{
Logging.Log(LogLevel.INFO, "DebugCheck(): Node not found: uniqueIdentity={0}", uniqueID);
}
else
{
Logging.Log(LogLevel.INFO, "DebugCheck(): Node: {0}",JObject.FromObject(node).ToString());
CheckJob checkJob = new CheckJob(node);
Logging.Log(LogLevel.INFO, "Prepare...");
checkJob.Prepare();
Logging.Log(LogLevel.INFO, "Check...");
checkJob.RunJob();
}
}
}
}