import com.mathworks.toolbox.distcomp.mjs.service.ConfigUtil; import com.mathworks.toolbox.distcomp.control.PortConfig; import com.mathworks.util.PlatformInfo; import com.mathworks.toolbox.parallel.pctutil.logging.DistcompFileHandler; import com.mathworks.toolbox.parallel.pctutil.logging.DistcompSimpleFormatter; import com.mathworks.toolbox.parallel.pctutil.logging.DistcompLevel; /* Copyright 2004-2017 The MathWorks, Inc. */ // IMPORTANT!!!: Please note that the system properties referenced here actually get set // start-mlworker.config file, are read by the service constructor on STDIN and then are // set using a the java.lang.System.setProperty method before the service makes use of the // config file. This is because MATLAB does not accept -D arguments. In order to see a // property here, you need to add them to the String[] that is passed as the 6th argument // to the SharedActivatableServiceDescriptor in start-mlworker.config com.mathworks.toolbox.distcomp.mlworker { private static configDir = "${com.mathworks.toolbox.distcomp.toolboxroot}${/}config${/}"; persistenceDirectory = "${com.mathworks.toolbox.distcomp.persistenceDir}"; logDirectory = "${com.mathworks.toolbox.distcomp.logdir}"; serviceName = "${com.mathworks.toolbox.distcomp.servicename}"; jobManagerName = "${com.mathworks.toolbox.distcomp.jobmanagername}"; delayRegistration = "${com.mathworks.toolbox.distcomp.delay_registration}"; stopOnIdle = "${com.mathworks.toolbox.distcomp.stop_on_idle}"; lookupServiceQueryIntervalSecs = 30; maxWaitBeforeShutdownSecs = 10; lookupPort = PortConfig.getLookupUnicastPort("${com.mathworks.toolbox.distcomp.base_port}"); lookupHosts = "${com.mathworks.toolbox.distcomp.lookup_hosts}"; codebase = ""; policy = ConfigUtil.concat(new String[]{configDir,"jsk-all.policy"}); minServiceExportPort = PortConfig.getMinDistcompServiceExportPort("${com.mathworks.toolbox.distcomp.base_port}"); // Each worker needs 2 ports, so need a large port range to accommodate // machines running many workers. This range will allow approximately 2000 // workers. maxNumPorts = 4000; defaultRmiClientConnectTimeoutSecs = 5; logLevel = "${com.mathworks.toolbox.distcomp.loglevel}"; onDemand = "${com.mathworks.toolbox.distcomp.worker.onDemand}"; idleKillTimeoutInSeconds = 60; // Messages logged via LOGGER.log() in the Worker JVM will end up in this file. serviceLogFilePattern = ConfigUtil.concat(new String[]{ "${com.mathworks.toolbox.distcomp.logdir}${/}", "worker-service-log_", "${com.mathworks.toolbox.distcomp.hostname}_", serviceName, ".%u.%g", //unique number and sequence number ".log"}); serviceHandler = new DistcompFileHandler(serviceLogFilePattern, true, DistcompLevel.getLevelFromValue(Integer.parseInt(logLevel)), 10, 100000000, new DistcompSimpleFormatter()); securityLevel = "${com.mathworks.toolbox.distcomp.securityLevel}"; securityDir = "${com.mathworks.toolbox.distcomp.securityDir}"; useSecureCommunication = Boolean.parseBoolean("${com.mathworks.toolbox.distcomp.rmi.useSecureCommunication}"); requireWebLicensing = Boolean.parseBoolean("${com.mathworks.toolbox.distcomp.requireWebLicensing}"); requireClientCertificate = Boolean.parseBoolean("${com.mathworks.toolbox.distcomp.rmi.requireClientCertificate}"); taskEvaluator = "com.mathworks.toolbox.distcomp.mjs.worker.matlab.MatlabTaskEvaluator"; matlabroot = "${com.mathworks.toolbox.distcomp.matlabroot}"; // These properties control how the Worker starts MATLAB. matlabExecutable = "${com.mathworks.toolbox.distcomp.matlabexecutable}"; // Use -noFigureWindows on Windows and -nodisplay everywhere else private static nodisplay = ConfigUtil.ifThenElse( /*if*/ PlatformInfo.isWindows(), /*then*/ "-noFigureWindows", /*else*/ "-nodisplay" ); // Can add other command line arguments: e.g -timing or -jdb // In addition to these arguments, the PID of the Java worker service is automatically // added as an argument to the initworker.m script matlabArguments = new String[]{"-dmlworker", nodisplay, "-r", "initworker"}; // Can be used to instrument the workers for debugging, with e.g. strace or gdb. // Will be placed in front of the MATLAB executable on the command line workerInstrumentation = new String[]{}; // Messages in logged in MATLAB via LOGGER.log() or dctSchedulerMessage will end up in this file. matlabLogFilePattern = ConfigUtil.concat(new String[]{ "${com.mathworks.toolbox.distcomp.logdir}${/}", "worker-matlab-log_", "${com.mathworks.toolbox.distcomp.hostname}_", serviceName, ".%u.%g", ".log"}); matlabHandler = new DistcompFileHandler(matlabLogFilePattern, true, DistcompLevel.getLevelFromValue(Integer.parseInt(logLevel)), 10, 100000000, new DistcompSimpleFormatter()); // MATLAB stdout and stderr streams are written to this file. matlabOutputFilePattern = "${com.mathworks.toolbox.distcomp.matlabOutputFilePattern}"; matlabOutputMaxTotalSize = 1000000000; // 1GB matlabOutputMaxNumFiles = 10; matlabEnvironment = new String[]{ "HOSTNAME", "${com.mathworks.toolbox.distcomp.hostname}", "BASE_PORT", "${com.mathworks.toolbox.distcomp.base_port}", "USE_SERVER_SPECIFIED_HOSTNAME", "${com.mathworks.toolbox.distcomp.rmi.useServerSpecifiedHostname}", "MDCS_PEERSESSION_KEEP_ALIVE_PERIOD", "${com.mathworks.toolbox.distcomp.pmode.keepAlivePeriod}", "MDCS_PEERSESSION_KEEP_ALIVE_TIME_UNIT", "${com.mathworks.toolbox.distcomp.pmode.keepAliveTimeUnit}", "MDCS_MAX_NUM_PORTS", Integer.toString(maxNumPorts), "MDCS_MATLAB_DRIVE_ENABLED_ON_WORKER", "${com.mathworks.toolbox.distcomp.matlabDriveEnabledOnWorker}", "MW_MATLAB_DRIVE_FOLDER_LOCATION_CFG", "${com.mathworks.toolbox.distcomp.matlabDriveFolderLocationCfg}"}; // Other useful variables to set for debugging purposes are: //"PCTIPC_VERBOSE", "DEBUG4", //"PCTIPC_LOGFILE", ConfigUtil.concat("/tmp/pctipc_", serviceName, ".log") // Set by mdce_def "WORKER_START_TIMEOUT" property matlabStartupTimeoutSecs = Long.parseLong("${com.mathworks.toolbox.distcomp.workerstarttimeout}"); windowsDomain = "${com.mathworks.toolbox.distcomp.worker.windowsDomain}"; lifecycleReporter = "${com.mathworks.toolbox.distcomp.worker.lifecycleReporter}"; workerLifecycleHeartBeatSeconds = Long.parseLong("${com.mathworks.toolbox.distcomp.worker.workerLifecycleHeartBeat}"); taskLifecycleHeartBeatSeconds = Long.parseLong("${com.mathworks.toolbox.distcomp.worker.taskLifecycleHeartBeat}"); // By default do not use an activatable exporter. useActivatableExporter = false; }