-
Notifications
You must be signed in to change notification settings - Fork 36
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
Initial client script #207
Comments
spiga: Replying to [ticket:207 spiga]:
|
mcinquil: Please Review |
mcinquil: This first version handles the cli interaction, the user configuration, the possibility to have more job type plugins, interact with the credentials and with the server.
|
spiga: I'd like to check in the code but Simon/Dave would comment/check first I think. some clarifications I think may avoid confusion:
that should be more or less all for the moment. |
metson: Some comments from reading through the patch:
|
metson: Clarifications after chatting with Daniele re. JobType:
|
metson: Also, if the configuration file changes, a migration script should be provided... |
metson: So conclusion was:
I think that was all, Daniele can add whatever I've inevitably missed |
spiga: About the deploy script we had a discussion too... and for completeness let me add as reference what Dave suggested time ago: "On a related note to this, I started on a DeployWMClient script yesterday to allow users to deploy WMCore and httplib2 for config cache upload tests. Its probably a good idea to follow this method for Crab Client as well, either by adding it to the DeployWMClient stuff or cloning it to make a DeployCrabClient script (which I guess comes down to how many dependencies they share) https://svnweb.cern.ch/trac/CMSDMWM/wiki/WMClientDeployment |
metson: Replying to [comment:10 spiga]:
Ah yes, and I said I'd set up a sub system in the WMCore setup.py for CRAB Client (I'll do a server one too, while I'm at it...) |
metson: From Mattia:
The point is that the exceptions should in the majority of cases come from the server (e.g. if you can talk to the server and get a response any exception will be an HTTP error from the server). I don't think you need to wrap that further. Also, exceptions aren't that useful in the client - as you say, if one is raised it's basically going to print a message and exit, there's not going to be much beyond that in terms of exception handling - so having a bunch of specific exceptions is somewhat code bloat. Basically I'd see the first version of the client have no exceptions (e.g. just use ones from pythons standard library. ValueError, HTTPError etc.) and only add specific exceptions in very complicated, rare cases. I wouldn't be surprised if the final client had no specialised exceptions in either...
I think it's more a question of where loggers/options are handled. I'd argue that a CrabClient object should be given a root logger (which it either uses or makes it's own logger from) and it's configuration (determined from some options), and not get them itself. This means you can:
This basically results in something like the following client code: {{{ if name == 'main': But also means I can unit test the CrabClient class without any user input (e.g. by building a configuration for the class and passing in a bunch of commands for the run_command()). Speaking of which... there's no unit tests for the classes, a first pass at them should be added before this goes in :) |
mcinquil: Please Review |
metson: Please Review |
metson: The attached patch should apply on top of Mattia's. It's not quite as finished as I'd like but I think shows some of what I was trying to get across earlier. I think the following dependencies from WMCore should be added (which makes install more complex than I'd like...):
Anyway, give it a review and we'll go from there. Sorry to be a bit of a pain with all this, but I think it's important to start as we mean to go on. |
spiga: Replying to [comment:15 metson]:
uhm... I see you changed your mind a bit after our chat.. All seems reasonable but this patch requires some time/effort for a version 0. I understood we agreed to go toward this model in 2 steps.. and I'm still convinced of this approach.
If I'm allowed to stress one more time what I think I'd definitely go for the previous patch and use it as starting point. Next milestones will then include the reviewed client based on what you are proposing and Mattia will start taking care of this ~right now. anyway I leave you guys the very last word. |
evansde: Had a detailed look through both of the above patches, notes: Does it really need that many directories? Surely these are modules at most? The goal is to keep the client simple, so starting with a boatload of dirs is probably a bad first step. etc/ConfigTest.py => name something more obvious (CrabClientConfig.py?) Documentation of modules and methods needs to be added. Anyone vaguely enterprising will look at the client to see how it works, make sure the docs & comments are clear from the start. Dont see the need for the jobtype at all. Different types of job are handled on the reqmgr side, on the client side it would just be a string that would default to the Analysis std spec. Dislike the client class in the init module, not obvious where to find it. If we are going to have a package at all, it should contain clearly named modules. In the client class stuff like: def set_logger(self, logger) should be made into properties, it will streamline the code that much more. I think most of the commands talking to the server will result in some sort of JSON returned, would suggest adding a simple formatter to print a JSON structure for command line summaries. Just out of interest, if we are aiming for a simple client in the longer term, why dont we have a simple prototype to start with? |
spiga: uhm... so what you agreed yesterday is going to change... for what concern the jobtype I disagree.. what you say is an oversimplification... and it is not corresponding to what I learnt and what I have in mind. What I think for a client is something like a tool which should also help the final user to address his activities.. so jobtype is something which should wrap actions etc. and produce a well standardized output. Then the fact that with a string you can materialize a schema (getting it from the server) to be applied to a abstract class is another step ahead I already discussed with simon and it make perfectly sense to me. for all the other comments (naming, documentation, logger etc) I think I see all useful tickets for the next version 1. About your view of the commands I think I agree even I'd say you could over simplifying a bit the real life. At least this is my feeling with a +n coming from the discussion we previously had with "the crab side of the team". But for sure I'm open to evaluate this on the field. answering to your last question I'd say that
and if there is room for a question: Daniele |
evansde: Replying to [comment:18 spiga]:
I agreed yesterday that starting with a functional prototype and simplifying it down is a good way to go. I still feel that is a good way to proceed. I dont really agree with you on the job type thing, I think it should be kept simple (simple, when dealing with users is a good thing) IMO jobtype = string which defines a dictionary of fields which you fill and post to the server. I would say that if you have a decent idea of what version 2 is going to look like, version 0 & 1 should at least look like steps on the way to that. In answer to your question, I dont think this looks like a version 0.
Then you have a basic client that completes the fundamental thing that the client needs to do and you will see where the overlap is between the essentially 3 functions. You can test this, make sure its robust and then add other features once it has been proven. If you have to make changes, which you will for any prototype, its minimal invested effort, as opposed to full scale package refactors. |
spiga: ok we can easily conclude that we have different points of view and we can discuss on concepts over and over again but honestly I don't see how to solve this... There are different approaches and disagreements which I feel are for principle by meaning wo/ numbers on the hands. I feel committed to provide the support for the analysis with the agent. I'm trying to do that and I know that the client which has been proposed is not orthogonal to any basic concept.. It implements what I now expect for a client based on my experience and I feel like I spent some time supporting analysis in cms and I'd like to being able to express an opinion. So again it seems to me that many points on the discussions which have been raised are matter of points of view. I'm always happy to be reviewed by whom I know has a better and deep knowledge than me (as I usually do).. to be sure that I'm not writing bad code but there is an important concept: I would be also "free", by meaning being able to express my idea and knowledge coding what I feel committed too (please go to 1 ...and remark if I'm assuming wrong). Said that I need you clarify which are the degree of freedom that people working in WM can have since I guess i did wrong assumptions... Daniele |
evansde: Yep, code review is all about points of view. Ill let you decide on wether you want to listen to mine above, its you that gets to support & maintain it etc. I would expect that the majority of the code for the client should exist in the unittests for the server API, since thats where you would have to exercise all the API's that the server will provide anyways. |
metson: Replying to [comment:16 spiga]:
Sorry, I wasn't clear. I was listing the dependencies that the client has on WMCore - the first two come from Mattia's original patch, the last two I (begrudgingly) think should be added (as the ServerInteractions class is basically the JSONRequest, the plugin management does the same thing as WMFactory). I've not added the last two dependencies but I think it probably makes sense to. I've not changed my mind in that I think this is a bigger dependency than I'd like, but I think it's probably the only way to reduce code duplication. The changes I made in the patch were, I think, all that we agreed upon. I've made some tweaks in response to what Dave mentioned, which I think tidies the code up a bit. The lack of any unit tests in Mattia's patch (and the pretty poor test coverage of what I added) should be considered a blocker for this going into SVN IMHO. |
ewv: Where does this stand? I'd hoped that this would finally be allowed into SVN so that I could start working on some of the unit tests. Alternatively, I tried to apply the three patches here to get something to work with, but that doesn't seem to work either. Someone have instructions? It seems to me that process is getting the way of work here and I don't really understand why. |
mcinquil: I will post a patch based on last Simon patch (and of course on top of the other patches). |
mcinquil: Replying to [comment:24 mcinquil]:
...and after this patch the client should work fine, and unit tests dev. can start from the very basic tests Simon has already added. |
mcinquil: Please Review |
metson: * I think exposing tracebacks to the user isn't a good idea
}}}
Other wise looks good. Looks like the test dir didn't get added to my original patch, I shouldn't submit patches at 3am, I know you've got it from Dropbox - can you add it to your patch so Eric has something to work from? |
mcinquil: Replying to [comment:27 metson]:
I think before going to users will need some testing and bugs discovery...if a not expected traceback is raised me, Daniele, Eric, whoever want can easily see what's happened. Then, for user this wont be in there!
Because, by default you have been setting logging level to WARNING and verbose was corresponding to INFO...while I would like to have INFO by default and verbose something else, but I think we shuld evaluate it.
That is for user output, in the directory of the task you have the 'crab.log' which has more information (as the timestamp). I wouldn't expose to the user the file/class/method name, even in debug mode (since the client is thin and we expect to stay like this, for a developer/operator should be easy to understand the proble if any is in there).
The full line is 83 chars. Which was the limit? Wasn't 80?
If you look it is only a print saying ~nothing. Anyway, I understand and I will remove it.
Yes, I agree...than, should it preserve the print or use the logging as the other commands?
The point for this is that, the workarea should be created as soon as possible, as the file logger (which IMO should be per request, so inside the workarea). Than, I think that the need is that a workarea is always needed, unless the user will not specify an option saying "--nocache". More in general, I do not think the configuration needs always to be checked in the loadConfig module (eg: thinking to an user that hit "crab status").
Ok. I forgot to add it as well :) I will update the patch. |
metson: Replying to [comment:28 mcinquil]:
Right, but you could run with {{{--debug}}} and use a logger.debug - it's the print that I'm objecting to more than anything.
I'd leave the -v flag in and make the default True, for now, then.
Even for user output having the timestamps and level are useful IMHO.
That's fine by me, either one per line or one line (but be consistent). I forget the line length we set but I think it was upped to 120 or so since everyone has nice widescreen mac's ;)
Right, it says nothing because there's no job types to print out yet...
Use print for this one (and probably for other places where getting information to the screen is the aim) - the point is that the result of the command is the list of job types being printed to the screen. If you use the logger your client options can hide the result of the command, which is not what you want.
I would have the logging separate from the working area (I agree you need a log per workflow) just so people can delete working areas while still having a copy of what went on. That doesn't change the valid point you made - something needs to create an area to write the log (and set up a work area). I'd move that into initialise(), or maybe even further up into the {{{bin/crab}}} script (and do the configuration loading there and just pass in the configuration object to the handler)
The configuration holds the URL for the CRAB server, so anything that talks to the server is going to need to read the config. It might be that we're putting too much in one configuration file - maybe there's a need to have a config that's for the job (CMSSW, runs, lumis etc) and another that holds more static/infrastructural information (server URL etc.)
Great minds fail alike... ;)
Thanks |
mcinquil: Replying to [comment:29 metson]:
Ok..but you have already set that to use the print. If you prefer mixing loggin and print to me it is fine (I would perefer "if options.debug: print traceback")
ok
While the TS are in the log file, we can start with minimal information and see if it will be needed.
:)
I wouldn't mix around the code logging and print calls (maybe printing the same things...then we'll end up with a dedicated class that inherit logging and does this).
I do not see this to be so trivial:
Anyway I will try to put the createWorkArea somewhere else that applies to your comment.
I hope that the server host:port and similar will not be in the user configuration, so that part will be removed (and since we have a central point we can evaluate to use an alias for the host and to always use that). |
mcinquil: Please Review |
metson: Please Review |
metson: If you guys are happy with the attached patch I'm happy that the code gets committed. |
metson: Please Review |
mcinquil: Please Review |
1 similar comment
mcinquil: Please Review |
metson: That addition on top of my series looks fine to me (sorry I missed those imports out). Lets get this committed! |
metson: (In 27efe9f) First pass at a client for CRAB3 From: Simon Metson simonmetson@googlemail.com |
Aim to wrap server negotiation, myproxy, upload of input. This ticket not include workflow creation which depend on CMSSW interaction (which has a dedicated ticket).
The script must implement :
The text was updated successfully, but these errors were encountered: