Job waiting

Now in place: waiting for jobs to complete.

How it works: after a job starts, it’s added to a list of jobs being monitored, and is observed via Cocoa Key-Value Observing for its state key path. An NSConditionLock object is also created for each job being monitored, and when the state change is observed, the condition is set to correspond to the new state.

When the client code calls -[DRMAASession waitForJobId:timeout:error:], it simply tries to obtain a lock on the job with the XgridDRMAAJobConditionDoneOrFailed condition (using NSConditionLock’s timeout locking methods if a timeout is specified). Once the lock is obtained, it asks the Xgrid thread for a job info object, which right now consists of basically no data because I haven’t implemented an executable wrapper to actually collect the data. (Xgrid doesn’t collect it on its own.)

Leave a Reply