Project

General

Profile

SAM files and station for testing

Using SAMWeb

Note:

The client application is still subject to change. For real use, some or all of these operations can be embedded in the experiment framework. Since they are all relatively simple HTTP calls, this should not be too complicated.

The establish consumer operation is no longer required. The commit process functionality still exists, but hasn't yet been implemented on the client side, so is missing from this example.

$ ./samweb_example_client.py -e minerva --dev list-files "run_number 798" 
MN_00000798_0005_numib_v04_0911090339_RawEvents.root
MN_00000798_0004_numib_v04_0911090239_RawEvents.root
MN_00000798_0007_numib_v04_0911090538_RawEvents.root
MN_00000798_0001_pdstl_v04_0911090019_RawEvents.root
MN_00000798_0003_numib_v04_0911090141_RawEvents.root
MN_00000798_0006_numib_v04_0911090439_RawEvents.root
MN_00000798_0002_numib_v04_0911090042_RawEvents.root

$ ./samweb_example_client.py -e minerva --dev locate-file MN_00000798_0002_numib_v04_0911090042_RawEvents.root
minerva_bluearc:/minerva/data/minerva/raw/numib/00/00/07/98
minerva_bluearc:/minerva/data/rawdata/downstream/raw/numib/00/00/07/98

$ ./samweb_example_client.py -e minerva --dev -s create-definition --group=minerva run_798_raw_samweb "run_number 798" 
Definition Name: run_798_raw_samweb
  Definition Id: 4016
  Creation Date: 2012-10-07T15:42:08
       Username: illingwo
          Group: minerva
     Dimensions: run_number 798

$ ./samweb_example_client.py -e minerva --dev list-definition-files run_798_raw_samweb
MN_00000798_0005_numib_v04_0911090339_RawEvents.root
MN_00000798_0004_numib_v04_0911090239_RawEvents.root
MN_00000798_0007_numib_v04_0911090538_RawEvents.root
MN_00000798_0001_pdstl_v04_0911090019_RawEvents.root
MN_00000798_0003_numib_v04_0911090141_RawEvents.root
MN_00000798_0006_numib_v04_0911090439_RawEvents.root
MN_00000798_0002_numib_v04_0911090042_RawEvents.root

$ projectname=$(uuidgen)
$ ./samweb_example_client.py -e minerva --dev start-project --defname=run_798_raw_samweb $projectname 
http://samweb.fnal.gov:8480/sam/minerva/dev/api/projects/minerva/036c73e5-e9ae-441b-aba9-1073214d8669

$ ./samweb_example_client.py -e minerva --dev start-process http://samweb.fnal.gov:8480/sam/minerva/dev/api/projects/minerva/036c73e5-e9ae-441b-aba9-1073214d8669 --appfamily=test --appname=test --appversion=1 --max-files=1
16428
$ ./samweb_example_client.py -e minerva --dev get-next-file http://samweb.fnal.gov:8480/sam/minerva/dev/api/projects/minerva/036c73e5-e9ae-441b-aba9-1073214d8669 16428
file:///minerva/data/rawdata/downstream/raw/numib/00/00/07/98/MN_00000798_0002_numib_v04_0911090042_RawEvents.root
$ ./samweb_example_client.py -e minerva --dev release-file http://samweb.fnal.gov:8480/sam/minerva/dev/api/projects/minerva/036c73e5-e9ae-441b-aba9-1073214d8669 16428 file:///minerva/data/rawdata/downstream/raw/numib/00/00/07/98/MN_00000798_0002_numib_v04_0911090042_RawEvents.root
$ ./samweb_example_client.py -e minerva --dev get-next-file http://samweb.fnal.gov:8480/sam/minerva/dev/api/projects/minerva/036c73e5-e9ae-441b-aba9-1073214d8669 16428
$ echo $?
0 

$ ./samweb_example_client.py -e minerva --dev stop-project 036c73e5-e9ae-441b-aba9-1073214d8669

"Old style" SAM


$ sam ping dbserver
The server 'SAMDbServer.minerva_dev:SAMDbServer' is alive.

$ sam list files --dim="run_number 7980000-7989999" 
Files:
   MN_00000798_0004_numib_v04_0911090239_RawEvents.root
   MN_00000798_0001_pdstl_v04_0911090019_RawEvents.root
   MN_00000798_0005_numib_v04_0911090339_RawEvents.root
   MN_00000798_0003_numib_v04_0911090141_RawEvents.root
   MN_00000798_0006_numib_v04_0911090439_RawEvents.root
   MN_00000798_0007_numib_v04_0911090538_RawEvents.root
   MN_00000798_0002_numib_v04_0911090042_RawEvents.root

File Count:         7
Average File Size:  300.74MB
Total File Size:    2.06GB
Total Event Count:  9051

$ sam locate MN_00000798_0002_numib_v04_0911090042_RawEvents.root
['minerva_bluearc:/minerva/data/minerva/raw/numib/00/00/07/98'
'minerva_bluearc:/minerva/data/rawdata/downstream/raw/numib/00/00/07/98']

$ sam create dataset definition --defname=run_798_raw --dim="run_number 7980000-7989999 and data_tier raw" --group=minerva
DatasetDefinition saved with definitionId = 3525

$ projectname=$(uuidgen)
$ sam start project --station=minerva --project=$projectname --defname=run_798_raw --group=minerva
ProjectInfo({
'baseProjectInfo' : BaseProjectInfo({
                        'projectName' : '13415100-86d7-465c-8eac-77b2671fd480',
                          'projectId' : 5237L,
                        'stationName' : 'minerva',
                         'snapshotId' : 7349L,
                         'personInfo' : PersonInfo({
                                        'emailAddress' : 'none',
                                           'firstName' : 'None',
                                            'lastName' : 'None',
                                            'personId' : 109L,
                                        'personStatus' : 'active',
                                                 'uid' : '7816',
                                            'userName' : 'sam',
                                        }),
                      'workGroupName' : 'minerva',
                      'projectStatus' : 'reserved',
                        'projectMode' : 'unknown',
                    }),
       'nodeName' : 'minos-sam02.fnal.gov',
          'osPID' : 13024L,
      'startTime' : SamTime(1314990342.0),
        'endTime' : SamTime('NULL'),
})
$ sam establish consumer --project=$projectname --station=minerva --appname=demo --appversion=1
CID 5478
$ sam establish consumer process --consumerId=5478 --project=$projectname --station=minerva --desc="some text" --limit=1
CPID 11462
$ sam get next file --cpid=11462 --project=$projectname --station=minerva --once
File /minerva/data/rawdata/downstream/raw/pdstl/00/00/07/98/MN_00000798_0001_pdstl_v04_0911090019_RawEvents.root
$ sam release file --cpid=11462 --project=$projectname --station=minerva --filename=/minerva/data/rawdata/downstream/raw/pdstl/00/00/07/98/MN_00000798_0001_pdstl_v04_0911090019_RawEvents.root --status=ok
$ sam get next file --cpid=11462 --project=$projectname --station=minerva --once
File END OF STREAM
$ sam commit process --cpid=11462 --status=completed