public abstract class _IScriptDisp extends Ice.ObjectImpl implements IScript
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 OMERO.scripts for more information.Modifier and Type | Field and Description |
---|---|
static java.lang.String[] |
__ids |
static long |
serialVersionUID |
ice_staticId
Constructor and Description |
---|
_IScriptDisp() |
Modifier and Type | Method and 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) |
void |
canRunScript_async(AMD_IScript_canRunScript __cb,
long scriptID)
Returns true if there is a processor which will run the
given script.
|
void |
deleteScript_async(AMD_IScript_deleteScript __cb,
long scriptID)
Delete the script on the server with id.
|
void |
editScript_async(AMD_IScript_editScript __cb,
OriginalFile fileObject,
java.lang.String scriptText)
Modify the text for the given script object.
|
void |
getParams_async(AMD_IScript_getParams __cb,
long scriptID)
Get the parameters that the script takes and returns, along with
other metadata available from the script.
|
void |
getScriptID_async(AMD_IScript_getScriptID __cb,
java.lang.String path)
Get the id of an official script by the script path.
|
void |
getScripts_async(AMD_IScript_getScripts __cb)
This method returns official server scripts as a list of
OriginalFile objects. |
void |
getScriptsByMimetype_async(AMD_IScript_getScriptsByMimetype __cb,
java.lang.String mimetype)
This method returns official server scripts identified
with the specified extension as a list of
OriginalFile objects. |
void |
getScriptText_async(AMD_IScript_getScriptText __cb,
long scriptID)
Get the text from the server for the script with given id.
|
void |
getScriptWithDetails_async(AMD_IScript_getScriptWithDetails __cb,
long scriptID)
Get the script from the server with details from OriginalFile
|
void |
getUserScripts_async(AMD_IScript_getUserScripts __cb,
java.util.List<IObject> acceptsList)
Returns non-official scripts which have been uploaded by individual users.
|
protected void |
ice_copyStateFrom(Ice.Object __obj) |
java.lang.String |
ice_id() |
java.lang.String |
ice_id(Ice.Current __current) |
java.lang.String[] |
ice_ids() |
java.lang.String[] |
ice_ids(Ice.Current __current) |
boolean |
ice_isA(java.lang.String s) |
boolean |
ice_isA(java.lang.String s,
Ice.Current __current) |
static java.lang.String |
ice_staticId() |
void |
runScript_async(AMD_IScript_runScript __cb,
long scriptID,
java.util.Map<java.lang.String,RType> inputs,
RInt waitSecs)
If
ResourceError is thrown, then no
Processor is available. |
void |
uploadOfficialScript_async(AMD_IScript_uploadOfficialScript __cb,
java.lang.String path,
java.lang.String scriptText)
Like
uploadScript but is only callable by
administrators. |
void |
uploadScript_async(AMD_IScript_uploadScript __cb,
java.lang.String path,
java.lang.String scriptText)
Upload a user script to the server and return the id.
|
void |
validateScript_async(AMD_IScript_validateScript __cb,
Job j,
java.util.List<IObject> acceptsList)
Used internally by processor.py to check if the script
attached to the
Job has a valid script
attached, based on the acceptsList and the current
security context. |
___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
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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
public static final java.lang.String[] __ids
public static final long serialVersionUID
protected void ice_copyStateFrom(Ice.Object __obj) throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
public boolean ice_isA(java.lang.String s)
ice_isA
in interface Ice.Object
ice_isA
in class Ice.ObjectImpl
public boolean ice_isA(java.lang.String s, Ice.Current __current)
ice_isA
in interface Ice.Object
ice_isA
in class Ice.ObjectImpl
public java.lang.String[] ice_ids()
ice_ids
in interface Ice.Object
ice_ids
in class Ice.ObjectImpl
public java.lang.String[] ice_ids(Ice.Current __current)
ice_ids
in interface Ice.Object
ice_ids
in class Ice.ObjectImpl
public java.lang.String ice_id()
ice_id
in interface Ice.Object
ice_id
in class Ice.ObjectImpl
public java.lang.String ice_id(Ice.Current __current)
ice_id
in interface Ice.Object
ice_id
in class Ice.ObjectImpl
public static java.lang.String ice_staticId()
public final void canRunScript_async(AMD_IScript_canRunScript __cb, long scriptID) throws ServerError
Either the script is an official script and this method
will return true (though an individual invocation may fail
with an ResourceError
for some reason)
or this is a user script, and a usermode processor
must be active which takes the scripts user or group.
canRunScript_async
in interface _IScriptOperationsNC
__cb
- The callback object for the operation.ServerError
public final void deleteScript_async(AMD_IScript_deleteScript __cb, long scriptID) throws ServerError
deleteScript_async
in interface _IScriptOperationsNC
__cb
- The callback object for the operation.scriptID
- Id of the script to delete.ApiUsageException
SecurityViolation
ServerError
public final void editScript_async(AMD_IScript_editScript __cb, OriginalFile fileObject, java.lang.String scriptText) throws ServerError
editScript_async
in interface _IScriptOperationsNC
__cb
- The callback object for the operation.fileObject
- see above.ApiUsageException
SecurityViolation
ServerError
public final void getParams_async(AMD_IScript_getParams __cb, long scriptID) throws ServerError
getParams_async
in interface _IScriptOperationsNC
__cb
- The callback object for the operation.scriptID
- see above.ApiUsageException
ServerError
public final void getScriptID_async(AMD_IScript_getScriptID __cb, java.lang.String path) throws ServerError
getUserScriptID
)
since the path is not guaranteed to be unique.getScriptID_async
in interface _IScriptOperationsNC
__cb
- The callback object for the operation.path
- The name of the script.ApiUsageException
SecurityViolation
ServerError
public final void getScriptText_async(AMD_IScript_getScriptText __cb, long scriptID) throws ServerError
getScriptText_async
in interface _IScriptOperationsNC
__cb
- The callback object for the operation.scriptID
- see above.ApiUsageException
ServerError
public final void getScriptWithDetails_async(AMD_IScript_getScriptWithDetails __cb, long scriptID) throws ServerError
getScriptWithDetails_async
in interface _IScriptOperationsNC
__cb
- The callback object for the operation.scriptID
- see aboveApiUsageException
ServerError
public final void getScripts_async(AMD_IScript_getScripts __cb) throws ServerError
OriginalFile
objects.
These scripts will be executed by the server if submitted
via runScript
. The input parameters
necessary for proper functioning can be retrieved via
getParams
.
The OriginalFile.path
value 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
getScripts_async
in interface _IScriptOperationsNC
__cb
- The callback object for the operation.ApiUsageException
SecurityViolation
ServerError
public final void getScriptsByMimetype_async(AMD_IScript_getScriptsByMimetype __cb, java.lang.String mimetype) throws ServerError
OriginalFile
objects.
These scripts will be executed by the server if submitted
via runScript
. The input parameters
necessary for proper functioning can be retrieved via
getParams
.
The OriginalFile.path
value 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
getScriptsByMimetype_async
in interface _IScriptOperationsNC
__cb
- The callback object for the operation.mimetype
- the mimetype identifying the scripts.ApiUsageException
SecurityViolation
ServerError
public final void getUserScripts_async(AMD_IScript_getUserScripts __cb, java.util.List<IObject> acceptsList) throws ServerError
getUserScripts_async
in interface _IScriptOperationsNC
__cb
- The callback object for the operation.ServerError
public final void runScript_async(AMD_IScript_runScript __cb, long scriptID, java.util.Map<java.lang.String,RType> inputs, RInt waitSecs) throws ServerError
ResourceError
is thrown, then no
Processor
is available. Use scheduleJob
to create a ScriptJob
in the
Waiting state. A Processor
may become
available.
try:
proc = scriptService.runScript(1, {}, None)
except ResourceError:
job = scriptService.scheduleScript(1, {}, None)
The ScriptProcess
proxy MUST be closed before
exiting. If you would like the script execution to continue
in the background, pass True
as 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.
runScript_async
in interface _IScriptOperationsNC
__cb
- The callback object for the operation.ServerError
public final void uploadOfficialScript_async(AMD_IScript_uploadOfficialScript __cb, java.lang.String path, java.lang.String scriptText) throws ServerError
uploadScript
but is only callable by
administrators. The parameters for the script are also
checked.uploadOfficialScript_async
in interface _IScriptOperationsNC
__cb
- The callback object for the operation.ServerError
public final void uploadScript_async(AMD_IScript_uploadScript __cb, java.lang.String path, java.lang.String scriptText) throws ServerError
uploadScript_async
in interface _IScriptOperationsNC
__cb
- The callback object for the operation.path
- see above.ApiUsageException
SecurityViolation
ServerError
public final void validateScript_async(AMD_IScript_validateScript __cb, Job j, java.util.List<IObject> acceptsList) throws ServerError
Job
has a valid script
attached, based on the acceptsList
and the current
security context.
An example of an acceptsList might be Experimenter(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.
validateScript_async
in interface _IScriptOperationsNC
__cb
- The callback object for the operation.ServerError
public static Ice.DispatchStatus ___getScripts(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
public static Ice.DispatchStatus ___getScriptsByMimetype(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
public static Ice.DispatchStatus ___getUserScripts(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
public static Ice.DispatchStatus ___getScriptID(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
public static Ice.DispatchStatus ___getScriptText(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
public static Ice.DispatchStatus ___uploadScript(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
public static Ice.DispatchStatus ___uploadOfficialScript(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
public static Ice.DispatchStatus ___editScript(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
public static Ice.DispatchStatus ___getScriptWithDetails(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
public static Ice.DispatchStatus ___getParams(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
public static Ice.DispatchStatus ___deleteScript(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
public static Ice.DispatchStatus ___runScript(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
public static Ice.DispatchStatus ___canRunScript(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
public static Ice.DispatchStatus ___validateScript(IScript __obj, IceInternal.Incoming __inS, Ice.Current __current)
public Ice.DispatchStatus __dispatch(IceInternal.Incoming in, Ice.Current __current)
__dispatch
in interface Ice.Object
__dispatch
in class Ice.ObjectImpl
protected void __writeImpl(IceInternal.BasicStream __os)
__writeImpl
in class Ice.ObjectImpl
protected void __readImpl(IceInternal.BasicStream __is)
__readImpl
in class Ice.ObjectImpl