Subscribe

Pho 0.4 — Job Control and Command-Line Tool

I’ve just uploaded the latest release of Pho, the Ruby client for the Talis Platform. The primary changes in the 0.4 release is a reworking of the code relating to Snapshots and Jobs to provide access to the detailed job lifecycle data that was added in Release 21 of the Platform.

Because jobs are executed asynchronously, the API now includes code to wait for a job to finish, with an option to monitor the progress updates.

For example the follow code fragment illustrates how to submit a reindex job, and then report on its progress:


store = Pho::Store.new("http://api.talis.com/stores/my-store", "user", "pass")
resp = Pho::Jobs.submit_reindex(store)
job = Pho::Jobs.wait_for_submitted(resp, store) do | job, message, time |
  puts "#{time} #{message}"
end

The wait_for_submitted method takes the response from submitting a job to the Platform and will then poll the API to wait until the job has completed. When the method returns it returns a Job object populated with the progress updates; its possible to also determine if the job was successful or not. If you pass a block to the method then the code will be called for each newly encountered progress update, including the start message and completion message.

This release also includes a fledgling command-line application for working with a Platform Store. Once you’ve installed the job you’ll have a new script called talis_store which you can use to interact with a platform store. There’s still some work to be done to make it nicer to use, but it covers the majority of the core operations already. To get help on this run:

talis_store help

As a quick example, here’s how to take a snapshot of a store and then download that snapshot to a local directory. In the process of downloading the snapshot the MD5 will be automatically verified:


talis_store backup -u user -p pass -s my-store -d ~/backups

For the next release I’m planning to add support for Changesets, which is format for describing changes to RDF graphs.

Leave a Reply