User Tools

Site Tools


PyICAT

An ICAT WebService client module

author: Christian Felder

       ICatClient -- ICAT WebService client
          ICatDAQ -- ICAT Data Acquisition using ICatClient
    ICatGetPlugin -- marshalling outgoing messages for ICatClient
UniqueObjectCache -- A file-based URL cache (uniqueness temp directories)
      ICatFactory -- ICAT WebService object factory (cached)
         ICatType -- type constants for creating, reading, updating objects

Update News

  • v1.9.0 Implemented changes for 4.3 and 4.4.
    • ICAT compatible with versions 4.2, 4.3, 4.4
    • Changed config file location ~/.config on UNIX, APPDIR on Windows
    • Monkey patch SSL verification using pyICAT.patch_ssl_verifiy_false() and added check_certificate flag to configuration.
    • Improved http/https detection of WSDL URL.
    • New tool for querying ICAT - icatconsole.
    • Major code cleanups.
  • v1.8.2 Enhanced Bugfix for suds ticket no. #376. Preserve unique cache for users. Enhanced Soap logging support.
  • v1.8.0 Implemented Bugfix for suds ticket no. #376. Enforce uniqueness temp directory.
  • v1.7.0 Remove cycle from ICatDAQ.addInvestigation because it will be removed in the upcoming ICAT release 4.3 (loops in graph).
  • v1.6.1 Bugfix release for 1.6.0. Fixed permission errors on empty ICATs when using ICatDAQ (constructor).

ICAT workshop in Lund in Sweden in March 2013

I held a talk at the ICAT face 2 face meeting at Max IV laboratory on Lund in Sweden. Handout slides are available below.

PyICAT handout

Prerequisites and third party modules

PyICAT aims to keep the number of dependencies as small as possible. Nevertheless, the following requirements must be met.

  • python, version >=2.6 (version 3.x not yet tested)
  • SUDS (tested with version 0.4.1), a lightweight SOAP python client for consuming Web Services

Gerrit code review

The Gerrit code review page for this project can be obtained using the following url.

PyICAT code review project

Get PyICAT sources

Source code distributions can be obtained using the following url.

PyICAT source code distribution

Use the following command to check out a read-only working copy anonymously.

git clone https://forge.frm2.tum.de/review/jcns/icat/pyicat

To get a list of versions use the following command.

git tag

typical output:

v1.0.0
v1.1.0
v1.1.1

To refer to a specific version (checkout specific version) after doing git clone.

git checkout v1.0.0

Install PyICAT

Since version 1.4 PyICAT uses pythons distutils package. To perform an installation just invoke the following command.

python setup.py install

Depending on your System you will need superuser privileges to do this, because of filesystem permissions.

To install into an user defined location you can specify a PREFIX.

export PREFIX=/opt/local
python setup.py install --prefix=$PREFIX

You will not need superuser privileges to do this. Take care of your PYTHONPATH environment. It has to include e.g. $PREFIX/lib/python2.6/site-packages.

Use PyICAT

Since version 1.4 PyICAT is shipped with the following programs.

icatconfig
icatdaq
icattest
icatconfig

Sets some default values for icatdaq and configures which plugin should be used for which instrument. Furthermore it is possible to store login credentials.

icatdaq

This is the main metadata acquisition program. Before using this program please run icatconfig. This program uses plugins for different instruments. To support your own instruments you have to write your own plugin (see below).

icattest

This program tests your connection to an ICAT WebService and performs some basic tests.

Example:

user@localhost:~% icattest apps.jcns.fz-juelich.de:5443 db/icat42 secret
login as: db/icat42
using WSDL: http://apps.jcns.fz-juelich.de:5443/ICATService/ICAT?wsdl
using WSDL: https://apps.jcns.fz-juelich.de:5443/ICATService/ICAT?wsdl
Tests finished

Create your own plugin

For this purpose inherit from PyICATs DAQ Plugin Abstract Base Class (DAQMeta) in module pyICAT.plugins.base. Store your plugin in some local directory named plugins and create an __init__.py file which specify the plugins.

For example if you have written a module myinstrument containing a class MyInstrumentDAQ which inherits from DAQMeta your __init__.py file has to contain the following.

__all__ = ["myinstrument"]

Using icatconfig to configure your plugin simply enter the following when prompt instrument plugins.module.class (press ENTER to skip):

myinstrument plugins.myinstrument.MyInstrumentDAQ

Take care of your PYTHONPATH environment. It has to contain the folder above plugins otherwise icatdaq would not recognize your plugin. If plugins directory is in your current working directory it should already work and you need not change your environment.

ICAT WebService Description Language

Due to service verification we offer an public available ICAT webservice.

ICAT WSDL

PyICAT API documentation

This project uses Doxygen documentation and Python docstrings inline documentation. Please use the following link to read the API documentation.

PyICAT API