Task #7003 (closed)
Bug: Scripts CLI inputs
Reported by: | wmoore | Owned by: | jamoore |
---|---|---|---|
Priority: | major | Milestone: | OMERO-4.4 |
Component: | Scripting | Version: | n.a. |
Keywords: | n.a. | Cc: | |
Resources: | n.a. | Referenced By: | n.a. |
References: | n.a. | Remaining Time: | 0.0d |
Sprint: | 2011-10-27 (1) |
Description (last modified by wmoore)
default=True
If I have a script with a Bool parameter like this:
scripts.Bool("Use_All_Timepoints", default=True)
And in the script launch command I use 'False', printing out the unwrapped script parameters gives me 'True'...
wjm:scripts will$ omero script launch 1055 IDs=601 Use_All_Timepoints=False Using session 0183460d-3f73-4448-91ee-78969b37d806 (will@localhost:4064). Idle timeout: 10.0 min. Current group: JRS-collab Job 719 ready Waiting.... Callback received: FINISHED *** start stdout *** * {'Line_Width': 4, 'Use_All_Timepoints': True, 'IDs': [601L], 'Data_Type': 'Image'}
Int to Float
I have a parameter where I want a list of ints:
scripts.List("Channels", grouping="4", description="List of Channels to process. E.g 1, 2").ofType(rint(0)),
But when I pass integers in the command line OR via Insight, I get these converted to Floats:
jrs-macbookpro-25107:scripts will$ omero script launch 559 IDs=158 Channels=1,4 Using session ea00a81e-13e3-40c1-99d9-85c6d5037096 (will@localhost:4064). Idle timeout: 10.0 min. Current group: Swedlow lab Job 268 ready Waiting.... Callback received: FINISHED *** start stdout *** * {'Channels': [1.0, 4.0], 'Line_Width': 1, 'IDs': [158L], 'Data_Type': 'Image'}
Change History (9)
comment:1 Changed 13 years ago by jmoore
- Milestone changed from Unscheduled to OMERO-Beta4.4
comment:2 Changed 13 years ago by wmoore
- Description modified (diff)
- Summary changed from Bug: Scripts CLI, default=True to Bug: Scripts CLI inputs
comment:3 Changed 13 years ago by jmoore
- Remaining Time set to 0.25
- Sprint set to 2011-10-27 (1)
- Status changed from new to accepted
Will, I've pushed this to https://github.com/joshmoore/openmicroscopy/tree/7003-scripts can you review?
I've fixed the boolean issue. You might want to take a look at the test case and see if there are any other specific values you'd like to have parsed to "false".
For the channel int list to float issue, I can't reproduce. Neither with the test nor with the command-line:
~/git/dist $ bin/omero script launch 567 Channels=1,4 Using session 777fa5d6-39ee-4a2e-90b8-aa2d2cbd7e46 (root@localhost:4064). Idle timeout: 10.0 min. Current group: system Job 317 ready Waiting.... Callback received: FINISHED *** start stdout *** * {'Channels': [1, 4], 'Use_All_Timepoints': True} * *** end stdout *** *** out parameters *** *** done ***
~/git/dist $ cat lib/scripts/7003.py import omero import omero.scripts as scripts def runAsScript(): client = scripts.client('7003.py', """Test various param types which seem to be failing""", scripts.Bool("Use_All_Timepoints", default=True), scripts.List("Channels").ofType(omero.rtypes.rint(0)), version="4.3.3", authors=["Josh Moore", "OME Team"], institutions=["Glencoe Software, Inc."], contact="ome-users@lists.openmicroscopy.org.uk", ) try: parameterMap = {} for key in client.getInputKeys(): if client.getInput(key): parameterMap[key] = client.getInput(key, unwrap=True) print parameterMap finally: client.closeSession() if __name__ == "__main__": runAsScript()
If you could find a way to reproduce, that'd be great.
comment:4 Changed 13 years ago by wmoore
- Remaining Time changed from 0.25 to 0
- Resolution set to fixed
- Status changed from accepted to closed
OK, the rint -> rfloat issue is NOT a bug. It just turns out that numpy.rint is not the same as omero.model.rint! ;)
>>> from numpy import * >>> rint <ufunc 'rint'>
The default=True bug seems to be fixed.
comment:5 Changed 12 years ago by wmoore
Josh - do you know if your 7003-scripts branch got merged into develop?
Just cleaning up my local branches and couldn't be sure that it had.
Cheers.
comment:6 Changed 12 years ago by jmoore
Will, nope, didn't go in. Does that mean your ok with a PR for it?
comment:7 Changed 12 years ago by wmoore
I haven't tested recently, but from the comments above I'd say it's good to go.
Cheers
comment:8 Changed 12 years ago by jmoore <josh@…>
(In [d1fc0e3e9e065fe1a08af46f883fc22df2001840/ome.git] on branch develop) Parse rbool specially (See #7003)
comment:9 Changed 12 years ago by jmoore <josh@…>
(In [1f431f0bfe787bb836f72cfbcbcf90de9da48280/ome.git] on branch develop) Passing test for list of rints (See #7003)
Adding Int -> Float bug to this ticket, since it covers the same issues. NB: Noticed this from Insight too (not just CLI)