A package of web services is available that allows remote users to run SAM commands to query the database and retrieve filenames and pnfs storage locations. You can also define datasets and retrieve the metadata for files. To simplify retrieving files we have provided a python script that takes a query string and will then ftp the files back to the local disk. This is the preferred method of retrieving data offsite. Please do not do repeated 'ls' commands in the ftp door as it is very resource intensive.
CVS GNUmakefile bin sam_setup.csh src ups DEPENDENCIES RELEASE_NOTES lib sam_setup.sh tmp
passwd = 'xxxxx'
The following web services commands are supported. Note that the different commands need different wsdl files.
--dim="query"and
--wsdl="http://www-numi.fnal.gov/sam_web_services/wsdl/DimensionsService.wsdl.xml"which is the name of the web service to contact. The query uses the same syntax as the sam translate constraints command. Here is a list of relevant dimensions.
samTranslateDimensions
--dim="run_type physics% and data_tier sntp-near and physical_datastream_name
cosmic and start_time < to_date('2005-10-02','yyyy-mm-dd') and
end_time > to_date('2005-10-01','yyyy-mm-dd')"
--wsdl="http://www-numi.fnal.gov/sam_web_services/wsdl/DimensionsService.wsdl.xml"
This returns a list of files. The current format is not terribly
friendly as it is just a dump of the python array. This
may improve.
samLocate --file=N00008695_0023.cosmic.sntp.R1_18.0.root --wsdl="http://www-numi.fnal.gov/sam_web_services/wsdl/DataFileService.wsdl.xml"This returns
Replica locations for N00008695_0023.cosmic.sntp.R1_18.0.root: <SOAPpy.Types.typedArrayType locationList at -1214966644>: ["'/pnfs/minos/reco_near/R1_18/sntp_data/2005-10,69@vo8804'"]
samDefineDataset --defName=test-dataset-for-web-services-v1
--defdesc="Near detector test dataset"
--group=minos --dim="run_type physics% and data_tier sntp-near and
physical_datastream_name cosmic and start_time < to_date('2005-10-02','yyyy-mm-dd') and
end_time > to_date('2005-10-01','yyyy-mm-dd')" --user=buckley --desc="Test dataset for
web services" --wsdl="http://www-numi.fnal.gov/sam_web_services/wsdl/DatasetService.wsdl.xml"
The dataset definition is assigned a unique ID number in the
database.
You can use an existing dataset definition and add additional
constraints to create your own dataset. For example lets say you are
interested in Far detector physics raw data for
the first half of June 2005. You
can use the data set
zeval-far-raw-physics and add an additional
constraint for the date range.
samDefineDataset --defName=my-dataset-v1 --desc="My dataset"
--group=minos
--dim="dataset_def_name zeval-far-raw-physics and start_time <= to_date('2005-06-15','yyyy-mm-dd')
and end_time >= to_date('2005-06-01','yyyy-mm-dd')" --user=buckley
--wsdl="http://www-numi.fnal.gov/sam_web_services/wsdl/DatasetService.wsdl.xml"
This creates a dataset of 332 files. Note the way that the date query is
done. This ensures that you pick up all the files that could have
started and ended during the time period of interest.
samGetMetadata --file=N00008695_0023.cosmic.sntp.R1_18.0.root --wsdl="http://www-numi.fnal.gov/sam_web_services/wsdl/DataFileService.wsdl.xml"This produces the following entry:
Metadata for N00008695_0023.cosmic.sntp.R1_18.0.root:
ImportedDetectorFile({
'fileName' : 'N00008695_0023.cosmic.sntp.R1_18.0.root',
'fileId' : 1311069L,
'fileType' : 'importedDetector',
'fileFormat' : 'root',
'fileSize' : SamSize('73.10MB'),
'crc' : CRC('2199668325L', 'adler 32 crc type'),
'fileContentStatus' : 'good',
'eventCount' : 49345L,
'dataTier' : 'sntp-near',
'firstEvent' : 1074345L,
'lastEvent' : 1120113L,
'startTime' : SamTime('01-Oct-2005 10:44:36 (UTC)','%d-%b-%Y %
H:%M:%S (UTC)'),
'endTime' : SamTime('01-Oct-2005 11:44:12 (UTC)','%d-%b-%Y %
H:%M:%S (UTC)'),
'applicationFamily' : ApplicationFamily(appFamily='reco', appName='loo
n', appVersion='r1.18'),
'group' : 'minos',
'parents' : NameOrIdList(['N00008695_0023.mdaq.root']),
'datastream' : 'cosmic',
'runDescriptorList' : RunDescriptorList([RunDescriptor(runType='physic
s;m', runNumber=8695)]),
})
You can use the following method to retrieve files:
--dim = "query"The query uses the same syntax as the samTranslateDimensions command.
minosGetFiles.py --dim="run_type physics% and data_tier sntp-near and
physical_datastream_name cosmic and start_time < to_date('2005-10-02','yyyy-mm-dd') and
end_time > to_date('2005-10-01','yyyy-mm-dd')"
You can also put in the name of an existing dataset as the query.
The script does a samTranslateDimensions to get the file list. For
each file it does samLocate to get the pnfs path and
then contacts the ftp dcache door and retrieves the
file. Run it from the directory that you want to put
the files in. Enhancements will be considered. Contact
buckley@fnal.gov
![]()