node-htcondor contains various nodejs hooks for htcondor.
To install:
npm install htcondor
Submit jobs
You can submit a condor job and watch for joblog.
var htcondor = ; //create condor submit objectvar submit_options = universe: "vanilla" executable: "test.sh" arguments: "hello" notification: "never" //transfer_output_files: 'bogus', requirements: '(Arch == "INTEL") || (Arch == "X86_64") && (machine == "some_ce")' shouldtransferfiles: "yes" when_to_transfer_output: "ON_EXIT" output: "stdout.txt" error: "stderr.txt" queue: 1; //submit to start the jobhtcondor;
You can do the usual condor stuff.
job;
job;
job;
You can also call via htcondor object
htcondor;
Also, if you are modern, you can use "then" .. on most htcondor methods.
htcondor;;
Query Jobs
Wrapper for condor_q
htcondor = ;htcondor;
Outputs job entry..
You can set various condor_q options.. like constraint, or attributes.
htcondor = ;htcondor;
In above, node-htcondor will "stream" output from htcondor q output - so callbacks will be called as soon as each job info is parsed - instead of waiting until all jobs info is received.
Alternatively, then() will not stream but wait until it receives all job entries in a single array.
htcondor = ;htcondor;
eventlog watcher
This module allows you to subscribe to condor event log (usually at /var/log/condor/EventLog), and receive callbacks so that you can monitor job status or any other attribute changes.
If you are monitoring jobs that you submit, then you can just watch the job log instead(See above). eventlog watcher is to monitor the entire cluster.
Obviously though.. you need to have EventLog enabled on your condor installation. You need to have something like following in your condor config.d if you don't see your EventLog generated already.
[/etc/condor/config.d/90eventlog.config]
EVENT_LOG=$(LOG)/EventLog
EVENT_LOG_JOB_AD_INFORMATION_ATTRS=Owner,CurrentHosts,x509userproxysubject,AccountingGroup,GlobalJobId,QDate,JobStartDate,JobCurrentStartDate,JobFinishedHookDone,MATCH_EXP_JOBGLIDEIN_Site,RemoteHost
EVENT_LOG_MAX_SIZE = 1000000
EVENT_LOG_MAX_ROTATIONS = 5
var eventlog = eventlog //you can start watching on your htcondor eventlogeventlog; //and receive eventseventlog;
eventlog.on() will be called for each classads posted. ads will look like following.
Why didn't I implement this more like fs.watch()? 2 reasons... You often need to start watch before you know which job id to watch (see submit sample below). Another reason is that, you usually don't have more than 1 EventLog, so there is no point of having multiple watcher watching the same log.
_jobid: '49563264.000.000' _timestamp: '12/15 19:12:25' _updatetime: Sun Dec 15 2013 19:12:25 GMT+ Proc: 0 EventTime: '2013-12-15T19:12:25' TriggerEventTypeName: 'ULOG_SUBMIT' SubmitHost: '<129.79.53.21:9615?sock=8287_a430_1068600>' QDate: 1387134745 TriggerEventTypeNumber: 0 MyType: 'SubmitEvent' Owner: 'donkri' CurrentHosts: 0 GlobalJobId: 'osg-xsede.grid.iu.edu#49563264.0#1387134745' Cluster: 49563264 AccountingGroup: 'group_xsedelow.donkri' Subproc: 0 EventTypeNumber: 28 CurrentTime: 'time()'
Call unwatch() to stop watchin on eventlog
eventlog
dump condor config
(This is a prototype feature)
You can dump all condor configs (in key/value dictionary).
htcondor;
Configuring the module
You may optionally configure the module by setting config
variable if HTCondor binaries or configuration are located in a non-standard location. Current options are:
- CondorLocation
- The location of the HTCondor install. The directory that contains htcondor's `bin`, `sbin`... directories. This will be used when issuing commands by prepending the command with the full path.
- CondorConfig
- Location of the Condor configuration file.
Warning
node-htcondor watches job logsi for all jobs submitted using Tail - which uses inotify kernel hook. Don't submit too many jobs at once. You need to throttle it so that you won't exeed your inotify limit imposed by your OS. (See /proc/sys/fs/inotify/max_user_watches) I might implement such throttling capability built into this module in the future..
License
MIT. Please see License file for more details.