Oh! I'm sorry for the confusion. I was using this before:
- Code: Select all
jobid = conn.getProperty("omero.job")
jobObj = queryService.findByQuery("from Job where id = :jobid", p)
jobObj.setMessage(rstring(msg))
updateService.saveObject(jobObj)
Which doesn't work as non-admin
Now I was trying to use:
- Code: Select all
jobid = c.getProperty("omero.job")
handle = c.sf.createJobHandle()
handle.attach(long(jobid))
status = handle.jobStatus()
handle.setMessage("Foo")
Now, ignore my previous message. There was an unrelated mistake in my code causing the setMessage() call not to be executed. However, this fixing this it gives the following error:
- Code: Select all
File "/home/service-unix-img/OMERO.server/lib/python/omero_api_JobHandle_ice.py", line 236, in setMessage
return _M_omero.api.JobHandle._op_setMessage.invoke(self, ((message, ), _ctx))
serverStackTrace = ome.conditions.ApiUsageException: An ome.model.jobs.JobStatus enum does not exist with the value: null
at ome.logic.TypesImpl.getEnumeration(TypesImpl.java:128)
at ome.services.JobBean.setStatusAndMessage(JobBean.java:304)
at ome.services.JobBean.setMessage(JobBean.java:297)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Changing to
- Code: Select all
handle.setMessage(rstring("foobar"))
Gives:
- Code: Select all
return _M_omero.api.JobHandle._op_setMessage.invoke(self, ((message, ), _ctx))
ValueError: invalid value for argument 1 in operation `setMessage'
Changing to:
- Code: Select all
handle.setStatusAndMessage("Running",rstring("foobar"))
Does work! And also as normal user! Solving the problem. However the API usage from
here is bit unclear in all this.
[edit]I see now, that the API docs do explain the rstring() usage. And I suspect that first calling handle.setStatus() before handle.setMessage() will fix the rather. Only this is not documented.[/edit]
Thanks,
Paul