Fix name parameters being ignored in Cluster class#398
Conversation
f42fe09 to
225f1cf
Compare
225f1cf to
1d837ce
Compare
|
@lesteve , are you still working here? If you are done, I suggest you ping one of the maintainers for review. |
|
I need to add some tests ... as the main active Dask-Jobqueue maintainer I guess I will have to ping myself once this is done 🙃 Out of curiosity do you have a particular interest in this PR ? |
|
Yes, figure it out, sorry; trying to check in on several dask repos at once! |
|
(but no, this is just one of a few PRs that seem to be green but marked WIP on the timescale of ~months) |
|
No worries, if you have some suggestion on the approach while you are here, this would be more than welcome ... This feels like one of this object-oriented thing where there must be a better way, but I just can not find it. Maybe I should have read more design patterns book when I was younger rather than studying Physics oh well ... |
|
Yeah, passing around lots of kwargs is painful. I suppose you could have some config dictionary somewhere and work with that. I don't have much of a concrete improvement proposal for you though. This line: is particularly painful, although I understand you don't want TypeErrors. |
|
Thanks a lot for having a look!
Yeah the problem is that the error happens in a class (job-level) that is quite far from the user (cluster-level) and I wanted a reasonably user-friendly error message. I agree it feels less than ideal ... |
|
The alternative would perhaps be requiring the job classes to accept arbitrary kwargs and ignore/error on unexpected items in the class itself. |
|
I think I thought about that at one point but it felt like the error message would not be as helpful for the user since the user creates a I thought doing that and catching the job level exception at the cluster level for a better opportunity at a helpful error message but I was not really convinced either. I'll try to have a second look at one point. I think one of my main worry currently is that my Thanks a lot for looking into anyway, I certainly appreciate the suggestions! |
1d837ce to
a8f317d
Compare
|
I am removing the WIP from this PR. The main thing I'd like to have some feedback on is the strategy on giving a reasonable error message to the user when he uses a parameter that does not exist in Here are the possible strategy I can see:
python -c 'from dask_jobqueue import SLURMCluster; \
cluster = SLURMCluster(\
cores=1,memory="1GB",wrong_parameter="wrong_parameter_value")'Error message:
The switch between 2. and 3. was done in this commit so you can get a better feel of the code involved. Any feed-back on the rest of this PR more than welcome! |
|
I am certainly -1 on possibility 2, even if the target classes tend to be simple. Of the remaining two, I am ambivalent - a raw TypeError seems simple enough to me, and keeps the code simple, but I can see why users wouldn't want to dig to find out what arguments were in fact expected. |
Fix #386 and a few other quirks I found along the way. This may be split in separate PRs, for example depending on what happens with #397 (Closes #397).
At the moment the main thing missing is:
validate_job_kwargsto make sure that the job kwargs exist either inJobQueueCluster.__init__(base class) orself.job_cls.__init__(derived class) and have a user-friendly error at the cluster-level. This may not work as a general solution (in case there are classes between the base and most derived class) but probably good enough as a first step. Or someone knows how to google this kind of Python design patterns and maybe something already exists I don't know.