{"action":"created","issue":{"url":"https://api.github.com/repos/dmwm/CRABServer/issues/5078","labels_url":"https://api.github.com/repos/dmwm/CRABServer/issues/5078/labels{/name}","comments_url":"https://api.github.com/repos/dmwm/CRABServer/issues/5078/comments","events_url":"https://api.github.com/repos/dmwm/CRABServer/issues/5078/events","html_url":"https://github.com/dmwm/CRABServer/pull/5078","id":116862000,"number":5078,"title":"Fix validate taskname","user":{"login":"AndresTanasijczuk","id":6575844,"avatar_url":"https://avatars.githubusercontent.com/u/6575844?v=3","gravatar_id":"","url":"https://api.github.com/users/AndresTanasijczuk","html_url":"https://github.com/AndresTanasijczuk","followers_url":"https://api.github.com/users/AndresTanasijczuk/followers","following_url":"https://api.github.com/users/AndresTanasijczuk/following{/other_user}","gists_url":"https://api.github.com/users/AndresTanasijczuk/gists{/gist_id}","starred_url":"https://api.github.com/users/AndresTanasijczuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndresTanasijczuk/subscriptions","organizations_url":"https://api.github.com/users/AndresTanasijczuk/orgs","repos_url":"https://api.github.com/users/AndresTanasijczuk/repos","events_url":"https://api.github.com/users/AndresTanasijczuk/events{/privacy}","received_events_url":"https://api.github.com/users/AndresTanasijczuk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":22,"created_at":"2015-11-13T22:00:42Z","updated_at":"2015-11-18T09:41:59Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/dmwm/CRABServer/pulls/5078","html_url":"https://github.com/dmwm/CRABServer/pull/5078","diff_url":"https://github.com/dmwm/CRABServer/pull/5078.diff","patch_url":"https://github.com/dmwm/CRABServer/pull/5078.patch"},"body":"WARNING! INCOMPLETE PULL REQUEST.\r\nREAD ALL THIS COMMENT BEFORE MERGING.\r\n\r\n\r\nIn the first three commits of this PR I renamed some variables according to the following naming convention:\r\ntaskname = \\<YYMMDD\\>\\_\\<mmhhss\\>:\\<username\\>\\_crab\\_\\<requestname\\> (nothing new)\r\npartial taskname = crab_\\<requestname\\> (this is a new naming definition, for which you can suggest a better name; we need it because this is what the client passes as the 'workflow' parameter to the server)\r\nThen it comes the relevant commit of this PR, the 4th one. I identified many places where the taskname was being validated with the wrong regular expression (wrong in terms of allowed length, 232 instead of 255, besides the fact that both regular expressions already existed). Notice that here I also changed Jadir's new validation so that the taskname that goes into the DB can be up to 255 characters in length.\r\nThe 5th commit is to allow usernames of up to 15 characters in length (see the comment I added in the code).\r\nThe 6th commit is to remove the validation Jadir added last week, because the 4th commit should actually be enough. If for safety you prefer to keep Jadir's check, I can remove this last commit.\r\n\r\nWhat I am not sure about:\r\nRESTCampaign, is it used? I left in the validation of the 'workflow' parameter the RX_PARTIAL_TASKNAME regex so to not modify anything, since I don't understand what is this module used for. But I suspect it should be changed to RX_TASKNAME also.\r\n\r\nI tested this PR in my private server instance defining in my CRAB config file:\r\n```\r\nrequestName = 'test_loooooong_taskname'\r\nconfig.General.requestName = requestName + 'e'*(225 - len(requestName) - len('crab_'))\r\n```\r\n\r\n```\r\n$ crab submit\r\nWill use CRAB configuration file crabConfig.py\r\nImporting CMSSW configuration pset_tutorial_analysis.py\r\nFinished importing CMSSW configuration pset_tutorial_analysis.py\r\nSending the request to the server\r\nSuccess: Your task has been delivered to the CRAB3 server.\r\nTask name: 151112_161105:atanasi_crab_test_loooooong_tasknameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\r\nPlease use 'crab status' to check how the submission process proceeds.\r\nLog file is /afs/cern.ch/work/a/atanasi/crab3/CMSSW_7_3_5_patch2/src/crab_test_loooooong_tasknameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee/crab.log\r\n```\r\n\r\nThe task was written into the DB and the TaskWorker could change the status to QUEUED and then to SUBMITTED. (Btw, I could also reproduce the problem of task status left on HOLDING if I don't use this PR and remove Jadir's check.) Everything fine... except one thing: the upload of the TW log to the crabcache fails in this example, because the file name that we intend to give to the file in crabcache (taskname + '_TaskWorker.log') exceeds 255 chars. The upload starts in https://github.com/dmwm/CRABServer/blob/3.3.1511.rc1/src/python/TaskWorker/Actions/Handler.py#L120-L122 and the failure occurs in https://github.com/dmwm/CRABServer/blob/3.3.1511.rc1/src/python/UserFileCache/RESTFile.py#L93\r\n\r\n```\r\n[13/Nov/2015:16:43:12]  SERVER OTHER ERROR __builtins__.IOError 3541d4c22853a6c3c78a95926bb39659 ([Errno 36] File name too long: '/data/srv/state/crabcache/files/a/atanasi/15/151113_154259:atanasi_crab_test_loooooong_taskname_223_eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee_TaskWorker.log')\r\n[13/Nov/2015:16:43:12]    Traceback (most recent call last):\r\n[13/Nov/2015:16:43:12]      File \"/data/srv/HG1505c/sw.pre/slc6_amd64_gcc481/cms/crabcache/3.3.11.rc7-comp4/lib/python2.6/site-packages/WMCore/REST/Server.py\", line 697, in default\r\n[13/Nov/2015:16:43:12]        return self._call(RESTArgs(list(args), kwargs))\r\n[13/Nov/2015:16:43:12]      File \"/data/srv/HG1505c/sw.pre/slc6_amd64_gcc481/cms/crabcache/3.3.11.rc7-comp4/lib/python2.6/site-packages/WMCore/REST/Server.py\", line 772, in _call\r\n[13/Nov/2015:16:43:12]        obj = apiobj['call'](*safe.args, **safe.kwargs)\r\n[13/Nov/2015:16:43:12]      File \"/data/srv/HG1505c/sw.pre/slc6_amd64_gcc481/cms/crabcache/3.3.11.rc7-comp4/lib/python2.6/site-packages/UserFileCache/RESTFile.py\", line 141, in put\r\n[13/Nov/2015:16:43:12]        return RESTFile.put(self, inputfile, name)\r\n[13/Nov/2015:16:43:12]      File \"/data/srv/HG1505c/sw.pre/slc6_amd64_gcc481/cms/crabcache/3.3.11.rc7-comp4/lib/python2.6/site-packages/UserFileCache/RESTFile.py\", line 92, in put\r\n[13/Nov/2015:16:43:12]        handlefile = open(outfilename,'wb')\r\n[13/Nov/2015:16:43:12]    IOError: [Errno 36] File name too long: '/data/srv/state/crabcache/files/a/atanasi/15/151113_154259:atanasi_crab_test_loooooong_taskname_223_eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee_TaskWorker.log'\r\n[13/Nov/2015:16:43:12] osmatanasi2 188.184.135.65 \"PUT /crabcache/logfile HTTP/1.1\" 500 [data: 10461 in 723 out 18738 us ] [auth: OK \"/DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=atanasi/CN=710186/CN=Andres Jorge Tanasijczuk\" \"\" ] [ref: \"\" \"PycURL/7.19.3 libcurl/7.35.0 OpenSSL/1.0.1m zlib/1.2.8 c-ares/1.10.0\" ]\r\n```\r\n\r\nPossible solutions:\r\n\r\n1) Reduce the maximum allowed taskname length from 255 to e.g. 225, so that we have room to add for example '_TaskWorker.log' and still be below 255 chars.\r\n2) When forming the TW log file name to upload to crabcache, cut the tail of the taskname as much as needed to fit the additional '_TaskWorker.log'. This should be done in a function that would be called every time we form a filename based on the taskname. This requires changes in more places, but I think is the most robust solution.\r\n"},"comment":{"url":"https://api.github.com/repos/dmwm/CRABServer/issues/comments/157658182","html_url":"https://github.com/dmwm/CRABServer/pull/5078#issuecomment-157658182","issue_url":"https://api.github.com/repos/dmwm/CRABServer/issues/5078","id":157658182,"user":{"login":"cmsdmwmbot","id":15169205,"avatar_url":"https://avatars.githubusercontent.com/u/15169205?v=3","gravatar_id":"","url":"https://api.github.com/users/cmsdmwmbot","html_url":"https://github.com/cmsdmwmbot","followers_url":"https://api.github.com/users/cmsdmwmbot/followers","following_url":"https://api.github.com/users/cmsdmwmbot/following{/other_user}","gists_url":"https://api.github.com/users/cmsdmwmbot/gists{/gist_id}","starred_url":"https://api.github.com/users/cmsdmwmbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmsdmwmbot/subscriptions","organizations_url":"https://api.github.com/users/cmsdmwmbot/orgs","repos_url":"https://api.github.com/users/cmsdmwmbot/repos","events_url":"https://api.github.com/users/cmsdmwmbot/events{/privacy}","received_events_url":"https://api.github.com/users/cmsdmwmbot/received_events","type":"User","site_admin":false},"created_at":"2015-11-18T09:41:59Z","updated_at":"2015-11-18T09:41:59Z","body":"Beginning pylint tests.\nSee https://cmssdt.cern.ch/jenkins/job/DMWM-CRAB-PR-test/179/ for details"}}