Package omero.api
Class _IScriptDisp
- java.lang.Object
-
- Ice.ObjectImpl
-
- omero.api._IScriptDisp
-
- All Implemented Interfaces:
Ice.Object,java.io.Serializable,java.lang.Cloneable,_IScriptOperations,_IScriptOperationsNC,_ServiceInterfaceOperations,_ServiceInterfaceOperationsNC,IScript,ServiceInterface
- Direct Known Subclasses:
_IScriptTie
public abstract class _IScriptDisp extends Ice.ObjectImpl implements IScript
Utility service for managing and launching scripts for execution by the Processor API. Typical usage might include (PYTHON):
See OMERO.scripts for more information.sf = client.createSession() svc = sf.getScriptService() scripts = svc.getScripts() if len(scripts) >= 1: script_id = svc.keys()\[-1] else: script_id = svc.uploadScript('/test/my_script.py', SCRIPT_TEXT) params = svc.getParams(script_id) # You will need to parse the params to create the proper input inputs = {} # The last parameter is how long to wait as an RInt proc = svc.runScript(script_id, inputs, None) try: cb = omero.scripts.ProcessCallbackI(client, proc) while not cb.block(1000): # ms. pass cb.close() rv = proc.getResults(0) finally: proc.close(False)- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String[]__idsstatic longserialVersionUID-
Fields inherited from interface omero.api.IScript
ice_staticId
-
-
Constructor Summary
Constructors Constructor Description _IScriptDisp()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Ice.DispatchStatus___canRunScript(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)static Ice.DispatchStatus___deleteScript(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)static Ice.DispatchStatus___editScript(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)static Ice.DispatchStatus___getParams(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)static Ice.DispatchStatus___getScriptID(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)static Ice.DispatchStatus___getScripts(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)static Ice.DispatchStatus___getScriptsByMimetype(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)static Ice.DispatchStatus___getScriptText(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)static Ice.DispatchStatus___getScriptWithDetails(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)static Ice.DispatchStatus___getUserScripts(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)static Ice.DispatchStatus___runScript(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)static Ice.DispatchStatus___uploadOfficialScript(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)static Ice.DispatchStatus___uploadScript(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)static Ice.DispatchStatus___validateScript(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)Ice.DispatchStatus__dispatch(IceInternal.Incoming in, Ice.Current __current)protected void__readImpl(IceInternal.BasicStream __is)protected void__writeImpl(IceInternal.BasicStream __os)voidcanRunScript_async(AMD_IScript_canRunScript __cb, long scriptID)Returns true if there is a processor which will run the given script.voiddeleteScript_async(AMD_IScript_deleteScript __cb, long scriptID)Delete the script on the server with id.voideditScript_async(AMD_IScript_editScript __cb, OriginalFile fileObject, java.lang.String scriptText)Modify the text for the given script object.voidgetParams_async(AMD_IScript_getParams __cb, long scriptID)Get the parameters that the script takes and returns, along with other metadata available from the script.voidgetScriptID_async(AMD_IScript_getScriptID __cb, java.lang.String path)Get the id of an official script by the script path.voidgetScripts_async(AMD_IScript_getScripts __cb)This method returns official server scripts as a list ofOriginalFileobjects.voidgetScriptsByMimetype_async(AMD_IScript_getScriptsByMimetype __cb, java.lang.String mimetype)This method returns official server scripts identified with the specified extension as a list ofOriginalFileobjects.voidgetScriptText_async(AMD_IScript_getScriptText __cb, long scriptID)Get the text from the server for the script with given id.voidgetScriptWithDetails_async(AMD_IScript_getScriptWithDetails __cb, long scriptID)Get the script from the server with details from OriginalFilevoidgetUserScripts_async(AMD_IScript_getUserScripts __cb, java.util.List<IObject> acceptsList)Returns non-official scripts which have been uploaded by individual users.protected voidice_copyStateFrom(Ice.Object __obj)java.lang.Stringice_id()java.lang.Stringice_id(Ice.Current __current)java.lang.String[]ice_ids()java.lang.String[]ice_ids(Ice.Current __current)booleanice_isA(java.lang.String s)booleanice_isA(java.lang.String s, Ice.Current __current)static java.lang.Stringice_staticId()voidrunScript_async(AMD_IScript_runScript __cb, long scriptID, java.util.Map<java.lang.String,RType> inputs, RInt waitSecs)IfResourceErroris thrown, then noProcessoris available.voiduploadOfficialScript_async(AMD_IScript_uploadOfficialScript __cb, java.lang.String path, java.lang.String scriptText)LikeuploadScriptbut is only callable by administrators.voiduploadScript_async(AMD_IScript_uploadScript __cb, java.lang.String path, java.lang.String scriptText)Upload a user script to the server and return the id.voidvalidateScript_async(AMD_IScript_validateScript __cb, Job j, java.util.List<IObject> acceptsList)Used internally by processor.py to check if the script attached to theJobhas a valid script attached, based on theacceptsListand the current security context.-
Methods inherited from class Ice.ObjectImpl
___ice_id, ___ice_ids, ___ice_isA, ___ice_ping, __checkMode, __read, __read, __readImpl, __write, __write, __writeImpl, clone, ice_dispatch, ice_dispatch, ice_operationAttributes, ice_ping, ice_ping, ice_postUnmarshal, ice_preMarshal
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface omero.api._IScriptOperations
canRunScript_async, deleteScript_async, editScript_async, getParams_async, getScriptID_async, getScripts_async, getScriptsByMimetype_async, getScriptText_async, getScriptWithDetails_async, getUserScripts_async, runScript_async, uploadOfficialScript_async, uploadScript_async, validateScript_async
-
-
-
-
Field Detail
-
__ids
public static final java.lang.String[] __ids
-
serialVersionUID
public static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
ice_copyStateFrom
protected void ice_copyStateFrom(Ice.Object __obj) throws java.lang.CloneNotSupportedException- Throws:
java.lang.CloneNotSupportedException
-
ice_isA
public boolean ice_isA(java.lang.String s)
- Specified by:
ice_isAin interfaceIce.Object- Overrides:
ice_isAin classIce.ObjectImpl
-
ice_isA
public boolean ice_isA(java.lang.String s, Ice.Current __current)- Specified by:
ice_isAin interfaceIce.Object- Overrides:
ice_isAin classIce.ObjectImpl
-
ice_ids
public java.lang.String[] ice_ids()
- Specified by:
ice_idsin interfaceIce.Object- Overrides:
ice_idsin classIce.ObjectImpl
-
ice_ids
public java.lang.String[] ice_ids(Ice.Current __current)
- Specified by:
ice_idsin interfaceIce.Object- Overrides:
ice_idsin classIce.ObjectImpl
-
ice_id
public java.lang.String ice_id()
- Specified by:
ice_idin interfaceIce.Object- Overrides:
ice_idin classIce.ObjectImpl
-
ice_id
public java.lang.String ice_id(Ice.Current __current)
- Specified by:
ice_idin interfaceIce.Object- Overrides:
ice_idin classIce.ObjectImpl
-
ice_staticId
public static java.lang.String ice_staticId()
-
canRunScript_async
public final void canRunScript_async(AMD_IScript_canRunScript __cb, long scriptID) throws ServerError
Returns true if there is a processor which will run the given script.Either the script is an official script and this method will return true (though an individual invocation may fail with an
ResourceErrorfor some reason) or this is a user script, and a usermode processor must be active which takes the scripts user or group.- Specified by:
canRunScript_asyncin interface_IScriptOperationsNC- Parameters:
__cb- The callback object for the operation.- Throws:
ServerError
-
deleteScript_async
public final void deleteScript_async(AMD_IScript_deleteScript __cb, long scriptID) throws ServerError
Delete the script on the server with id. The file will also be removed from disk.- Specified by:
deleteScript_asyncin interface_IScriptOperationsNC- Parameters:
__cb- The callback object for the operation.scriptID- Id of the script to delete.- Throws:
ApiUsageExceptionSecurityViolationServerError
-
editScript_async
public final void editScript_async(AMD_IScript_editScript __cb, OriginalFile fileObject, java.lang.String scriptText) throws ServerError
Modify the text for the given script object.- Specified by:
editScript_asyncin interface_IScriptOperationsNC- Parameters:
__cb- The callback object for the operation.fileObject- see above.- Throws:
ApiUsageExceptionSecurityViolationServerError
-
getParams_async
public final void getParams_async(AMD_IScript_getParams __cb, long scriptID) throws ServerError
Get the parameters that the script takes and returns, along with other metadata available from the script.- Specified by:
getParams_asyncin interface_IScriptOperationsNC- Parameters:
__cb- The callback object for the operation.scriptID- see above.- Throws:
ApiUsageExceptionServerError
-
getScriptID_async
public final void getScriptID_async(AMD_IScript_getScriptID __cb, java.lang.String path) throws ServerError
Get the id of an official script by the script path. The script service ensures that all script paths are unique. Note: there is no similar method for user scripts (e.g.getUserScriptID) since the path is not guaranteed to be unique.- Specified by:
getScriptID_asyncin interface_IScriptOperationsNC- Parameters:
__cb- The callback object for the operation.path- The name of the script.- Throws:
ApiUsageExceptionSecurityViolationServerError
-
getScriptText_async
public final void getScriptText_async(AMD_IScript_getScriptText __cb, long scriptID) throws ServerError
Get the text from the server for the script with given id.- Specified by:
getScriptText_asyncin interface_IScriptOperationsNC- Parameters:
__cb- The callback object for the operation.scriptID- see above.- Throws:
ApiUsageExceptionServerError
-
getScriptWithDetails_async
public final void getScriptWithDetails_async(AMD_IScript_getScriptWithDetails __cb, long scriptID) throws ServerError
Get the script from the server with details from OriginalFile- Specified by:
getScriptWithDetails_asyncin interface_IScriptOperationsNC- Parameters:
__cb- The callback object for the operation.scriptID- see above- Throws:
ApiUsageExceptionServerError
-
getScripts_async
public final void getScripts_async(AMD_IScript_getScripts __cb) throws ServerError
This method returns official server scripts as a list ofOriginalFileobjects. These scripts will be executed by the server if submitted viarunScript. The input parameters necessary for proper functioning can be retrieved viagetParams. TheOriginalFile.pathvalue can be used in other official scripts via the language specific import command, since the script directory will be placed on the appropriate environment path variable.scripts = scriptService.getScripts() for script in scripts: text = scriptService.getScriptText(script.id.val) # First character is a "/" symbol path = script.path.val\[1:\] path = path.replace("/",".") print "Possible import: %s" % path- Specified by:
getScripts_asyncin interface_IScriptOperationsNC- Parameters:
__cb- The callback object for the operation.- Throws:
ApiUsageExceptionSecurityViolationServerError
-
getScriptsByMimetype_async
public final void getScriptsByMimetype_async(AMD_IScript_getScriptsByMimetype __cb, java.lang.String mimetype) throws ServerError
This method returns official server scripts identified with the specified extension as a list ofOriginalFileobjects. These scripts will be executed by the server if submitted viarunScript. The input parameters necessary for proper functioning can be retrieved viagetParams. TheOriginalFile.pathvalue can be used in other official scripts via the language specific import command, since the script directory will be placed on the appropriate environment path variable.scripts = scriptService.getScripts("py") for script in scripts: text = scriptService.getScriptText(script.id.val) path = script.path.val\[1:\] # First symbol is a "/" path = path.replace("/",".") print "Possible import: %s" % path- Specified by:
getScriptsByMimetype_asyncin interface_IScriptOperationsNC- Parameters:
__cb- The callback object for the operation.mimetype- the mimetype identifying the scripts.- Throws:
ApiUsageExceptionSecurityViolationServerError
-
getUserScripts_async
public final void getUserScripts_async(AMD_IScript_getUserScripts __cb, java.util.List<IObject> acceptsList) throws ServerError
Returns non-official scripts which have been uploaded by individual users. These scripts will not be run by the server, though a user can start a personal usermode processor which will allow the scripts to be executed. This is particularly useful for testing new scripts.- Specified by:
getUserScripts_asyncin interface_IScriptOperationsNC- Parameters:
__cb- The callback object for the operation.- Throws:
ServerError
-
runScript_async
public final void runScript_async(AMD_IScript_runScript __cb, long scriptID, java.util.Map<java.lang.String,RType> inputs, RInt waitSecs) throws ServerError
IfResourceErroris thrown, then noProcessoris available. UsescheduleJobto create aScriptJobin the Waiting state. AProcessormay become available.
Thetry: proc = scriptService.runScript(1, {}, None) except ResourceError: job = scriptService.scheduleScript(1, {}, None)ScriptProcessproxy MUST be closed before exiting. If you would like the script execution to continue in the background, passTrueas the argument.try: proc.poll() # See if process is finished finally: proc.close(True) # Detach and execution can continue # proc.close(False) # OR script is immediately stopped.- Specified by:
runScript_asyncin interface_IScriptOperationsNC- Parameters:
__cb- The callback object for the operation.- Throws:
ServerError
-
uploadOfficialScript_async
public final void uploadOfficialScript_async(AMD_IScript_uploadOfficialScript __cb, java.lang.String path, java.lang.String scriptText) throws ServerError
LikeuploadScriptbut is only callable by administrators. The parameters for the script are also checked.- Specified by:
uploadOfficialScript_asyncin interface_IScriptOperationsNC- Parameters:
__cb- The callback object for the operation.- Throws:
ServerError
-
uploadScript_async
public final void uploadScript_async(AMD_IScript_uploadScript __cb, java.lang.String path, java.lang.String scriptText) throws ServerError
Upload a user script to the server and return the id. This method checks that a script with that names does not exist and that the script has parameters if possible, i.e. a usermode processor is running which for the current user.- Specified by:
uploadScript_asyncin interface_IScriptOperationsNC- Parameters:
__cb- The callback object for the operation.path- see above.- Throws:
ApiUsageExceptionSecurityViolationServerError
-
validateScript_async
public final void validateScript_async(AMD_IScript_validateScript __cb, Job j, java.util.List<IObject> acceptsList) throws ServerError
Used internally by processor.py to check if the script attached to theJobhas a valid script attached, based on theacceptsListand the current security context. An example of an acceptsList might beExperimenter(myUserId, False)
, meaning that only scripts belonging to me should be trusted. An empty list implies that the server should return what it would by default trust. A valid script will be returned if it exists; otherwise null.- Specified by:
validateScript_asyncin interface_IScriptOperationsNC- Parameters:
__cb- The callback object for the operation.- Throws:
ServerError
-
___getScripts
public static Ice.DispatchStatus ___getScripts(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
-
___getScriptsByMimetype
public static Ice.DispatchStatus ___getScriptsByMimetype(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
-
___getUserScripts
public static Ice.DispatchStatus ___getUserScripts(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
-
___getScriptID
public static Ice.DispatchStatus ___getScriptID(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
-
___getScriptText
public static Ice.DispatchStatus ___getScriptText(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
-
___uploadScript
public static Ice.DispatchStatus ___uploadScript(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
-
___uploadOfficialScript
public static Ice.DispatchStatus ___uploadOfficialScript(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
-
___editScript
public static Ice.DispatchStatus ___editScript(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
-
___getScriptWithDetails
public static Ice.DispatchStatus ___getScriptWithDetails(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
-
___getParams
public static Ice.DispatchStatus ___getParams(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
-
___deleteScript
public static Ice.DispatchStatus ___deleteScript(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
-
___runScript
public static Ice.DispatchStatus ___runScript(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
-
___canRunScript
public static Ice.DispatchStatus ___canRunScript(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
-
___validateScript
public static Ice.DispatchStatus ___validateScript(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
-
__dispatch
public Ice.DispatchStatus __dispatch(IceInternal.Incoming in, Ice.Current __current)- Specified by:
__dispatchin interfaceIce.Object- Overrides:
__dispatchin classIce.ObjectImpl
-
__writeImpl
protected void __writeImpl(IceInternal.BasicStream __os)
- Overrides:
__writeImplin classIce.ObjectImpl
-
__readImpl
protected void __readImpl(IceInternal.BasicStream __is)
- Overrides:
__readImplin classIce.ObjectImpl
-
-