CasJobs Command Line Tool
Download 'casjobs.jar'
here
Download sample config file
here (Save this
as casjobs.config, not casjobs.config.x)
Download source 'casjobs.src.zip'
here
(includes libraries and ant script)
Description
A java command line tool for completing various tasks using CasJobs web services.
With this program you can:
View MyDB Tables
Submit jobs to all available queues.
Submit jobs and wait for them to complete
Extract data from tables and automatically download the output.
The CL tool is currently compatible with Java SDK v1.5 or higher (v1.6 recommended).
Compatibility is not usually tied to OS but rather the Java SDK version.
Compatibility
This program was compiled with Sun JDK v1.6. Compatibility with Java environments
from other vendors or with lower version numbers is untested.
Installation
Casjobs.config.x must first be renamed to Casjobs.config
Before first use, you must enter your wsid and password in the Casjobs.config file. Your wsid is located
at the top of the profile page here.
The CasJobsCL tool is distributed in executable *.jar format. Also included is a
config file, called 'CasJobs.config', which must be included in the same directory
as the executable. To run the program, type 'java -jar casjobs.jar' and append desired
arguments. To simplify calling the program, you can add a script in your path that
calls casjobs.jar.
This program can be configured to use a proxy by adding these lines to its
config file.
proxySet=true
proxyHost=proxy.somedomain.org
proxyPort=3128
Examples
From now on, 'casjobs' is assumed to be an alias for 'java -jar casjobs.jar'
casjobs --help commands
Lists all commands and their usage.
casjobs execute "select top 10 ra from photoobj"
Submits a query to the default target's lowest queue. Returns results to stdout.
casjobs submit -t dr2/60 -n "my query" -f "myquery.sql"
Submits query in myquery.sql to the dr2/60 queue with "my query" as the taskname.
Returns a jobid.
casjobs extract -d -a dataset -b "some_table"
Extracts a dataset from "some_table", waits for it to complete, then downloads the
results.
If you have problems running the CL tool, pl. see the
FAQ entry for the command-line tool.
Scripting Examples
This section assumes you have some basic scripting knowledge in whatever platform
you're on. It should give you an idea of how the tool might be scripted, but of
course these are not 100% platform-independent examples. You'll probably have to
modify them for your situation.
Example 1
casjobs run -t "dr2/1" -n "test query" "select top 10 ra into mydb.test0 from photoobj"
casjobs extract -b test0 -F -type fits -d
casjobs execute -t "dr2/1" -n "drop query" "drop table test0"
This example will:
run a query, then wait for it to finish
extract and download output from that query
drop the table the query created