Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing type check on RMQ port (and probably other parameters) #362

Closed
andre-merzky opened this issue Jul 16, 2019 · 4 comments
Closed

missing type check on RMQ port (and probably other parameters) #362

andre-merzky opened this issue Jul 16, 2019 · 4 comments

Comments

@andre-merzky
Copy link
Member

No description provided.

@andre-merzky
Copy link
Member Author

@lee212
Copy link
Contributor

lee212 commented Nov 1, 2019

PR #385, I attempt to add type conversion for user input parameters e.g. RMQ port. Other parameters concerned are either numerical value, boolean or python dictionary like:

reattempts (integer)
resubmit_failed (bool)
autoterminate (bool)
write_workflow (bool)
rmq_cleanup (bool)
rts_config (dict)

Maybe we can use ru's to_type function to apply a correct type? If this is agreed, to_type will expand to try bool and dict as it is currently checking int and float only. @andre-merzky , what is your thought?

@andre-merzky
Copy link
Member Author

It's somewhat tricky to do automatic type conversion in Python, since many conversions are possbile but don't give the intended results. For example:

>>> data = ['ab', 'cd']
>>> dict(data)
{'a': 'b', 'c': 'd'}
>>> data = 'foobar'
>>> list(data)
['f', 'o', 'o', 'b', 'a', 'r']

One needs some idea of the target type to do that sensibly. But, RU actually has a as_list() method which acts like this:

>>> ru.as_list(data=None)
[]
>>> ru.as_list(data='foo')
['foo']
>>> ru.as_list(data=['foo', 'bar'])
['foo', 'bar']

We similarly could add as_float(), as_int() etc. Is that what you are looking for?

@andre-merzky andre-merzky removed their assignment Jan 27, 2020
@lee212
Copy link
Contributor

lee212 commented Jul 7, 2020

PR #385 fixes this

@lee212 lee212 closed this as completed Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants