Purpose of GangaBox

The GangaBox was coded as a response to Bug 46033; and should allow a user to store any Ganga Object in an easy to understand way, associating a custom name with each object

User Interface

The Box implements and exports most of the python dict methods:

__getitem__, __setitem__, __delitem__, __len__, __contains__, clear, get, has_key, items, keys, values

This means most commands that work on dicts also work on the box. Renaming objects is currently not possible, one simple idea would be:

box.rename(old_name, new_name)

Typing 'box' on the command line prints the contents of the box:

Out[4]: Contents of the box:
      Name |     Category | Type
      test | applications | AthenaMC
     myLCG |     backends | LCG

It additionally has a help() method, that prints a short summary:

To show the contents of the box, just type 'box'

To put an object in the box, type:
box['precious object'] = object

To access an object in the box, type:
box['interesting thing']

To remove an object from the box, type:
del box['worthless stuff']

 (the names of the objects can be freely chosen) 

Technical Summary

  • The GangaBox has its own XML repository at gangadir/box.xml
  • There can be multiple boxes with different names, but at the moment only one box, named 'box' is defined.
  • The Box saves the repository on exit, on object insertion or every 30 seconds (in case of a crash)
  • It has simple timestamp locking, so one box will only be available from one ganga session.
  • The code is only 200 lines

Obtaining GangaBox

The GangaBox class is available at and should be included in some file after all modules are loaded (so that all Ganga Object definitions are available).

Major updates:
-- JohannesEbke - 04 May 2009

Responsible: -- JohannesEbke - 04 May 2009

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r2 - 2010-01-08 - WolfgangWalkowiak
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    ArdaGrid All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback