Package omero :: Module scripts
[hide private]
[frames] | no frames]

Module scripts

source code

Scripting types

Copyright 2008 Glencoe Software, Inc. All rights reserved. Use is subject to license terms supplied in LICENSE.txt

Classes [hide private]
  Type
omero.grid.Param subclass which provides convenience methods for input/output specification.
  Long
Wraps an rlong
  Int
Wraps an rint
  Double
Wraps an rdouble
  Float
Wraps an rfloat
  String
Wraps an rstring
  Bool
Wraps an rbool
  Color
Wraps an rinternal(Color)
  Point
Wraps an rinternal(Point)
  Plane
Wraps an rinternal(Plane)
  __Coll
Base type providing the append and extend functionality.
  Set
Wraps an rset.
  List
Wraps an rlist.
  Map
Wraps an rmap.
  ParseExit
Raised when this script should just parse parameters and return.
  MissingInputs
Functions [hide private]
 
client(*args, **kwargs)
Entry point for all script engine scripts.
source code
 
handleParse(c)
Raises ParseExit if the client has the configuration property "omero.scripts.parse".
source code
 
parse_text(scriptText)
Parses the given script text with "omero.scripts.parse" set and catches the exception.
source code
 
parse_file(filename)
Parses the given script file with "omero.scripts.parse" set and catches the exception.
source code
 
parse_inputs(inputs_strings, params)
Parses a command-line like string representation of input parameters into an RDict (a map from string to RType).
source code
 
parse_input(input_string, params)
Parse a single input_string.
source code
 
group_params(params)
Walks through the inputs of the given JobParams and returns a map-of-maps with Param names as the leaf nodes.
source code
 
error_msg(category, key, format_string, *args) source code
 
compare_proto(key, proto, input, cache=None) source code
 
expand(input) source code
 
check_boundaries(key, min, max, input) source code
 
check_values(key, values, input) source code
 
validate_inputs(params, inputs, svc=None, session=None)
Method used by processor.py to check the input values provided by the user launching the script.
source code
 
set_input(svc, session, key, value) source code
 
wait(client, process, ms=500)
Wrapper around the use of ProcessCallbackI
source code
Variables [hide private]
  TYPE_LOG = logging.getLogger("omero.scripts.Type")
  PROC_LOG = logging.getLogger("omero.scripts.ProcessCallback")
  ProcessCallbackI = omero.callbacks.ProcessCallbackI

Imports: os, Ice, logging, exceptions, omero_Scripts_ice, omero


Function Details [hide private]

client(*args, **kwargs)

source code 

Entry point for all script engine scripts.

Typical usage consists of:

   client = omero.scripts.client("name","description",             omero.scripts.Long("name"),...)

where the returned client is created via the empty constructor to omero.client using only --Ice.Config or ICE_CONFIG, and the function arguments are taken as metdata about the current script. With this information, all script consumers should be able to determine the required types for execution.

Possible types are all subclasses of omero.scripts.Type

To change the omero.model.Format of the stdout and stderr produced by this script, use the constructor arguments:

   client = omero.scripts.client(...,             stdoutFormat = "text/plain",
       stderrFormat = "text/plain")

If you would like to prevent stdout and/or stderr from being uploaded, set the corresponding value to None. If you would like to overwrite the value with another file, use client.setOutput(). Though it is possible to attach any RType to "stdout" or "stderr", there is an assumption that the value will be an robject(OriginalFileI())

Providing your own client is possible via the kwarg "client = ...", but be careful since this may break usage with the rest of the scripting framework. The client should not have a session, and must be configured for the argumentless version of createSession()

handleParse(c)

source code 

Raises ParseExit if the client has the configuration property "omero.scripts.parse". If the value is anything other than "only", then the parameters will also be sent to the server.

parse_text(scriptText)

source code 

Parses the given script text with "omero.scripts.parse" set and catches the exception. The parameters are returned.

WARNING: This method calls "exec" on the given text. Do NOT use this on data you don't trust.

parse_file(filename)

source code 

Parses the given script file with "omero.scripts.parse" set and catches the exception. The parameters are returned.

WARNING: This method calls "exec" on the given file's contents. Do NOT use this on data you don't trust.

parse_inputs(inputs_strings, params)

source code 

Parses a command-line like string representation of input parameters into an RDict (a map from string to RType). The input should be an iterable of arguments of the form "key=value".

For example, "a=1" gets mapped to {"a":1}

parse_input(input_string, params)

source code 

Parse a single input_string. The params

group_params(params)

source code 

Walks through the inputs of the given JobParams
and returns a map-of-maps with Param names as
the leaf nodes.

For example, for the following:

    Params("1", grouping = "A") # "A." is equivalent
    Params("2", grouping = "A.B")
    Params("3", grouping = "A.C")

this function returns:

    {"A" {"": "1" : "B" : "2", "C" : "3"} }

while:

    Params("1", grouping = "A")

returns:

    {"A" : "1"}

validate_inputs(params, inputs, svc=None, session=None)

source code 

Method used by processor.py to check the input values provided by the user launching the script. If a non-empty errors string is returned, then the inputs fail validation.

A service instance can be provided in order to add default values to the session. If no service instance is provided, values with a default which are missing will be counted as errors.