public static void Main(string[] args) { // can't initialize logger early because in MultiThreadWorker mode, JVM will read C#'s stdout via // pipe. When initialize logger, some unwanted info will be flushed to stdout. But we can still // use stderr Console.Error.WriteLine("input args: [{0}]", string.Join(" ", args)); if (args.Count() != 2) { Console.Error.WriteLine("Wrong number of args: {0}, will exit", args.Count()); Environment.Exit(-1); } if ("pyspark.daemon".Equals(args[1])) { var multiThreadWorker = new MultiThreadWorker(); multiThreadWorker.Run(); } else { RunSimpleWorker(); } }
public static void Main(string[] args) { assemblyHandler = new SparkCLRAssemblyHandler(); AppDomain.CurrentDomain.AssemblyResolve += assemblyHandler.Handle; // can't initialize logger early because in MultiThreadWorker mode, JVM will read C#'s stdout via // pipe. When initialize logger, some unwanted info will be flushed to stdout. But we can still // use stderr Console.Error.WriteLine("input args: [{0}] SocketWrapper: [{1}]", string.Join(" ", args), SocketFactory.SocketWrapperType); if (args.Length != 2) { Console.Error.WriteLine("Wrong number of args: {0}, will exit", args.Count()); Environment.Exit(-1); } if ("pyspark.daemon".Equals(args[1])) { if (SocketFactory.SocketWrapperType == SocketWrapperType.Rio) { // In daemon mode, the socket will be used as server. // Use ThreadPool to retrieve RIO socket results has good performance // than a single thread. RioNative.SetUseThreadPool(true); } var multiThreadWorker = new MultiThreadWorker(); multiThreadWorker.Run(); } else { RunSimpleWorker(); } }