Differences between revisions 30 and 43 (spanning 13 versions)
Revision 30 as of 2009-08-20 08:23:32
Size: 28854
Editor: solpc
Comment:
Revision 43 as of 2010-01-01 02:21:11
Size: 34382
Editor: solpc
Comment:
Deletions are marked like this. Additions are marked like this.
Line 42: Line 42:
The operations now supported are:

 * series_list -- Implemented within "show_series". Expects a single parameter "filter" which is used in regex to limit the number of seriesnames returned. See the man page for show_series. If e.g. all series with the word "mdi" are desired then the URL will be: http://jsoc.stanford.edu/cgi-bin/ajax/show_series?filter=mdi
 * series_struct -- Implemented in jsoc_info. Expects parameters as described below. Example URL for e.g. the series mdi.vw_V_lev18 is: http://jsoc.stanford.edu/cgi-bin/ajax/jsoc_info?op=series_struct&ds=mdi.vw_V_lev18 which returns the JSON version of the information in the shell commands "show_info -l mdi.vw_V_lev18" and "show_info -s mdi.vw_V_lev18" combined.
 * rs_summary -- Implemented in jsoc_info. Expects parameters as below. Example URL is http://jsoc.stanford.edu/cgi-bin/ajax/jsoc_info?op=rs_summary&ds=mdi.vw_V_lev18
 * rs_list -- Implemented in jsoc_info. Expects parameters as below. The lookdata call limits the recordset to 10,000 records. The present implementation (due to mjson library performance) can take a minute or more for 10,000 records. Use care. This and following functions expect an explicit recordset query which will resolve to a subset of the records in the given series. The example URL here returns a few keywords for 5 minutes (5 records) from the mdi.vw_V_lev18 data. http://jsoc.stanford.edu//cgi-bin/ajax/jsoc_info.csh?ds=mdi.vw_V_lev18[1996.05.01_12:00/5m&op=rs_list&key=DATAMEAN,T_OBS&seg=**NONE** [http://jsoc.stanford.edu//cgi-bin/ajax/jsoc_info.csh?ds=mdi.vw_V_lev18[1996.05.01_12:00/5m]&op=rs_list&key=DATAMEAN,T_OBS&seg=**NONE** http://jsoc.stanford.edu//cgi-bin/ajax/jsoc_info.csh?ds=mdi.vw_V_lev18%5B1996.05.01_12%3A00%2F5m%5D&op=rs_list&key=DATAMEAN%2CT_OBS&seg=**NONE**]]

The operations now supported at http://jsoc.stanford.edu/cgi-bin/ajax are:

 * Implemented via show_series
  * series_list -- Implemented within "show_series". Expects a single parameter "filter" which is used in regex to limit the number of seriesnames returned. See the man page for show_series. If e.g. all series with the word "mdi" are desired then the URL will be: {{{ http://jsoc.stanford.edu/cgi-bin/ajax/show_series?filter=mdi%5C. }}}
 * Implemented via jsoc_info
  * series_struct -- Like "show_info -l -s" Example URL for e.g. the series mdi.vw_V_lev18 is: {{{ http://jsoc.stanford.edu/cgi-bin/ajax/jsoc_info?op=series_struct&ds=mdi.vw_V_lev18 }}} which returns the JSON version of the information in the shell commands "show_info -l mdi.vw_V_lev18" and "show_info -s mdi.vw_V_lev18" combined.
  * rs_summary -- Implemented in jsoc_info. Example URL is {{{ http://jsoc.stanford.edu/cgi-bin/ajax/jsoc_info?op=rs_summary&ds=mdi.vw_V_lev18 }}} At present returns first and last record information.
  * rs_list -- Implemented in jsoc_info. Functions similar to the shell command "show_info" to get dataseries record attributes.
 * Implemented via jsoc_fetch
  * exp_request -- Primary data export request tool. Expects a recordset specification and desired export method. Exported data will be either delivered immediately or kept online for 7 days depending on calling parameters and online status of the data. If a the data is not immediately available a "RequestID" is returned to the user for later access to the exported data.
  * exp_repeat -- Repeats the request for an expired (export data package is gone after 7 days). Expects RequestID.
  * exp_status -- Checks on status of prior request, expects RequestID.
  * exp_su -- Special tool for export of SUMS "Storage Units" to remote DRMS sites.

The details are below, but some examples here may help.
The lookdata call limits the recordset to 10,000 records. The present implementation can take a minute or more for 10,000 records. Use care. This and following functions expect an explicit recordset query which will resolve to a subset of the records in the given series.

The example URL here returns a few keywords for 5 minutes (5 records) from the mdi.vw_V_lev18 data. {{{
http://jsoc.stanford.edu/cgi-bin/ajax/jsoc_info_test?ds=mdi.vw_V_lev18%5B1996.05.01%2F5m%5D&op=rs_list&key=DATAMEAN%2CT_OBS
}}} Note the excape characters for URL encoding: '[' to '%5B', ']' to '%5D', '/' to %2F, ',' to '%2C' etc. The return json text from this query, with white space added, is: {{{{
  "keywords":[{"name":"DATAMEAN",
               "values":["321.424972",
                         "320.428355",
                         "320.296396",
                         "319.591784",
                         "320.101514"] },
              {"name":"T_OBS",
               "values":["1996.05.01_00:01:00_TAI",
                         "1996.05.01_00:02:00_TAI",
                         "1996.05.01_00:03:00_TAI",
                         "1996.05.01_00:04:00_TAI",
                         "1996.05.01_00:05:00_TAI"] } ],
  "segments":[],
  "links":[],
  "count":5,
  "status":0
} }}}

Note that the same query can be made to the shell command, 'show_info' which is also available as a cgi-bin call alongside jsoc_info. Show_info returns text while jsoc_info returns json. In this example "wget" is used to get the response as plain text in the file "pt"
{{{
wget -O pt 'http://jsoc.stanford.edu/cgi-bin/ajax/show_info?ds=mdi.vw_V_lev18%5B1996.05.01%2F5m%5D&key=DATAMEAN%2CT_OBS'
}}}
with the response in pt:
{{{
DATAMEAN T_OBS
321.424972 1996.05.01_00:01:00_TAI
320.428355 1996.05.01_00:02:00_TAI
320.296396 1996.05.01_00:03:00_TAI
319.591784 1996.05.01_00:04:00_TAI
320.101514 1996.05.01_00:05:00_TAI
}}}

The prototype access web tool "http://jsoc.stanford.edu/ajax/lookdata.html" uses show_series and jsoc_info. The prototype export tool "http://jsoc.stanford.edu/ajax/exportdata.html" uses jsoc_fetch.
Line 65: Line 114:

Under certain modes (ie., op=exp_su), jsoc_fetch will accept either HTTP GET or HTTP POST requests. Handling of the latter type of requests was implemented using API calls into the qDecoder library.
Line 247: Line 298:
   Method: GET - user should protect against multiple identical requests.    Method:  POST or GET - user should protect against multiple identical requests.
Line 260: Line 311:
     * file - uploaded file in case ds == "*file*"
Line 274: Line 326:
     * rcount - number of records found in the recordset.
Line 284: Line 337:

Option for providing the desired RecordSet via an uploaded file is not implemented. For this case the "ds" param must be "*file* and the POST method must be used. In this case the assumption is that a possibly hidden iframe is used and the returned json script will be in the implied <body> tag so content type will be text/html rather than json. The uploaded file should be provided with the field name "file" and should consist of lines of RecordSet specs.

Note: presently testing file upload in jsoc_fetch_test and exportdata2.html. Present limit of 8192 chars in the uploaded file.
Line 313: Line 370:
     * DATA section (present only if the export request was initiated by an exp_su cmd - see below) - contains 5 columns: 1. storage-unit number, 2. owning series name, 3. path to storage unit, if known, 4., storage-unit status (Y - online, N - offline but archived, X - neither online nor archived, and therefore not retrievable, I - invalid storage-unit number).
Line 317: Line 375:
 op=exp_su - this call initiates export of a StorageUnit to a remote DRMS  op=exp_repeat - This call initiates a re-export of a prior export which has expired. Only the RequestID need be provided, and optionally new requestor contact info for email notification.
   Usage: Used to renew an expired export, results in repeat of any needed calculations or processing.
   Mdthod: GET or POST
   Expects:
     * requestid - RequestID of record in jsoc.exports from prior successful export request.
     * notify - email address of user. May be omitted.
   Returns:
     Same as for exp_status.
}}}
Note: If RequestID corresponds to a current online request, the retention will be extended and no further action will be taken, return will be as if exp_status was requested. Otherwise, an export record (in jsoc.export) with a status==0 will be updated in the corresponding record in jsoc.export_new with a status=2 and a possibly new notify address. The re-exported product will have the same RequestID but a new sunum.

Implemented in jsoc_fetch_test and exportdata2.html.

{{{
 op=exp_su - This call initiates export of a StorageUnit to a remote DRMS. If data are online and available at the time the call is made, then a status of 0 is returned, and a list of per-SU data are returned. If the data are not online and archived, this call will initiate an asynchronous retrieval of data from SUMS. In that case, polling for retrieval completion can be achieved with exp_status calls.
Line 319: Line 391:
   Method: GET
   Expects:
     * requestor - name of remote DRMS site.
     * method - name of export method, e.g. ftp, tape, url
     * sunum - storage unit number
   Method: GET or POST
   Expects:
     * requestor (optional, used only in the case a retrieval request is made) - name of remote DRMS site.
     * method - name of export method, e.g. ftp, tape, url, url_quick
     * ds - comma-separated list of storage unit numbers
     * protocol - specifies the type of files that the exported storage unit should contain (as-is or FITS)
     * format - the format of the response (txt, json, html, xml)
     * formatvar - variant of the format, for format=json, formatvar=dataobj will cause the property named "data" to be an object containing storage-unit objects instead of an array of storage-unit objects.
Line 325: Line 400:
     * status - 0=OK immediate data available or delayed request in queue,
                1=processing,
                2=large request needs manual confirm,
                3=bad SU
        if status is 3 returns element "error" containing error message
     * status - 0=OK all data are online and available at the time of the exp_su call,
                2=an asynchronous data retrieval request was made because not all data were online,
Line 331: Line 403:
     * dir - URL of requested data if is available now and staged type.      * protocol
Line 333: Line 405:
     * wait - estimated seconds until data is available if status==1.
     * contact - email address, name to contact if status==2. user should contact with RequestID.
}}}
Note: This will be implemented as an option in jsoc_fetch and the return status can be examined with op=exp_status. Thus the return values will be made available using the same methods as op=exp_request. This is why the names are a bit different than in earlier versions of this document. I.e.
     * wait - estimated seconds until data is available if status==2.
     * DATA section - contains 5 columns: 1. storage-unit number, 2. owning series name, 3. path to storage unit, if known, 4., storage-unit status (Y - online, N - offline but archived, X - neither online nor archived, and therefore not retrievable, I - invalid storage-unit number).
}}}
Note: This is implemented as an option in jsoc_fetch and the return status can be examined with op=exp_status. Thus the return values will be made available using the same methods as op=exp_request. This is why the names are a bit different than in earlier versions of this document. Under the op=exp_su mode, jsoc_fetch will accept both HTTP GET and HTTP POST requests.

AJAX Interface for JSOC

Plan:

  • Implement basic access to keywords and segment information via CGI-BIN GET and POST server programs to allow Javascript access to basic JSOC functions.
  • Provide basic browser side html to demonstrate capability and serve as a starting point for simple use and development.
  • Publish the spec for the interface to allow others to build better Client-side tools.

Overview of Export Management

Exports will be managed in the series jsoc.exports Each request will be given a RequestID which can be used to track status. Data to be exported can be requested via several methods. The data requested will be collected (e.g. tar) and placed in a data segment in a record in jsoc.exports. It will be exported (i.e. picked up by the requestor) directly from the SUMS directory.

Series: jsoc.exports will not be archived and retention time of 7 days. Thus the Requestor will have one week to fetch the data. The export record will be retained for a history log of exports.

The jsoc.exports series looks like:

P% show_info jsoc.exports -l
Prime Keys are:
        RequestID
DB Index Keys are:
        RequestID
All Keywords for series jsoc.exports:
        DataSet         (string)        Dataset requested
        ExpTime         (time)  Time of export
        FilenameFmt     (string)        File basname format
        Format          (int)   Data format code
        Notify          (string)        Notification address
        ReqTime         (time)  Time of request
        RequestID       (int)   Export request identifier
        Requestor       (string)        Name of requestor
        Size            (int)   Volume of data requested
        Status          (int)   Status of request
Segments for series jsoc.exports:
        Data                 NA generic VAR     Exported data

{ - need to add keywords for export method (URL, tape, etc) and export function requested (i.e. convert to fits, rebin, extract, etc.)}

Status of prototype implementation of the draft plan

Many of the functions described below are now implemented in series_info and in a new module called jsoc_info which has heritage in show_info but emits JSON responses. Several open-source tools have been used in developing jsoc_info as well as http://jsoc.stanford.edu/ajax/lookdata.html which is a test client-side javascript code to use jsoc_info. These include:

The operations now supported at http://jsoc.stanford.edu/cgi-bin/ajax are:

  • Implemented via show_series
    • series_list -- Implemented within "show_series". Expects a single parameter "filter" which is used in regex to limit the number of seriesnames returned. See the man page for show_series. If e.g. all series with the word "mdi" are desired then the URL will be:  http://jsoc.stanford.edu/cgi-bin/ajax/show_series?filter=mdi%5C. 

  • Implemented via jsoc_info
    • series_struct -- Like "show_info -l -s" Example URL for e.g. the series mdi.vw_V_lev18 is:   http://jsoc.stanford.edu/cgi-bin/ajax/jsoc_info?op=series_struct&ds=mdi.vw_V_lev18  which returns the JSON version of the information in the shell commands "show_info -l mdi.vw_V_lev18" and "show_info -s mdi.vw_V_lev18" combined.

    • rs_summary -- Implemented in jsoc_info. Example URL is  http://jsoc.stanford.edu/cgi-bin/ajax/jsoc_info?op=rs_summary&ds=mdi.vw_V_lev18  At present returns first and last record information.

    • rs_list -- Implemented in jsoc_info. Functions similar to the shell command "show_info" to get dataseries record attributes.
  • Implemented via jsoc_fetch
    • exp_request -- Primary data export request tool. Expects a recordset specification and desired export method. Exported data will be either delivered immediately or kept online for 7 days depending on calling parameters and online status of the data. If a the data is not immediately available a "RequestID" is returned to the user for later access to the exported data.
    • exp_repeat -- Repeats the request for an expired (export data package is gone after 7 days). Expects RequestID.
    • exp_status -- Checks on status of prior request, expects RequestID.
    • exp_su -- Special tool for export of SUMS "Storage Units" to remote DRMS sites.

The details are below, but some examples here may help. The lookdata call limits the recordset to 10,000 records. The present implementation can take a minute or more for 10,000 records. Use care. This and following functions expect an explicit recordset query which will resolve to a subset of the records in the given series.

The example URL here returns a few keywords for 5 minutes (5 records) from the mdi.vw_V_lev18 data.

http://jsoc.stanford.edu/cgi-bin/ajax/jsoc_info_test?ds=mdi.vw_V_lev18%5B1996.05.01%2F5m%5D&op=rs_list&key=DATAMEAN%2CT_OBS

Note the excape characters for URL encoding: '[' to '%5B', ']' to '%5D', '/' to %2F, ',' to '%2C' etc. The return json text from this query, with white space added, is:

JsocWiki: AjaxJsocConnect (last edited 2022-08-23 02:53:50 by PhilScherrer)