/srv/irclogs.ubuntu.com/2013/07/04/#launchpad-dev.txt

StevenKwgrant: https://code.launchpad.net/~stevenk/launchpad/3102-by-default/+merge/17293701:28
wgrantStevenK: k01:29
StevenKwgrant: It's been weaned off -groups, was that your only concern?04:03
wgrantStevenK: Did you consider using Job.makeDerived instead of the stuff on line 150 of the diff?04:22
wgrantAlso, I'd spell out SPRs in the GENERATE_PACKAGE_DIFF description, given that the initialism is ambiguous nowadays04:23
StevenKwgrant: I considered it, but given we're getting back an actual IJob, I didn't know what makeDerived would actually return, or just error -- and UniversalJobSource is called from another process so is difficult to debug and I know cls(job) works.04:24
wgrantI'm also not sure I understand exactly how the delegation from PackageDiffJobDerived works.04:24
wgrantStevenK: I don't think makeDerived exists on the class you want it to today, but I suggest that you make it exist.04:24
wgrantMake Job-only jobs as similar to non-Job-only jobs as possible04:25
wgrantWe're just merging the additional class into Job, effectively04:25
wgrantSo Job.makeDerived makes sense for Job-only jobs.04:25
StevenKThen I need a mapping of type to class and circular imports?04:26
wgrantA good point04:28
wgrantA comment to that effect would be very helpful04:29
StevenKwgrant: http://pastebin.ubuntu.com/5842427/04:32
wgrantStevenK: That doesn't really explain anything. makeDerived not existing isn't a problem, because you could just add makeDerived. The problem is that Job.makeDerived would be a mess of circular imports, so it's probably cleaner to just do this.04:36
StevenKwgrant: http://pastebin.ubuntu.com/5842436/04:38
wgrantThat's more explanatory :)04:38
wgrantStevenK: I guess these can be run with run_jobs.py now?04:39
wgrantRather than process-job-source-groups.py04:39
wgrantHm04:39
wgrantprocess-job-source.py exists as well04:39
wgrantWhat is the different between that and run_jobs.py...04:39
StevenKrun_jobs takes a job name, process-job-source.py takes a source04:41
wgrantCertainly04:41
wgrantBut what is the difference?04:41
wgrantAFAICT run_jobs shouldn't exist any more04:42
wgrantThere are still three config sections for it04:42
StevenKprocess-job-source.py uses the same internals as run_jobs, and the latter is still being used on ackee and loganberry04:42
wgrantBut I suspect they can be migrated to process-job-source.py-style entries in about 20 lines of diff04:42
wgrantHow odd04:43
StevenKIt's backing of JobCronScript can't die, however04:43
StevenK% bzr grep run_jobs | cut -d/ -f804:43
StevenKrun_jobs.py -vv initializedistroseries >>04:43
StevenKrun_jobs.py pofile_stats >>04:43
StevenKrun_jobs.py  packaging_translations -q --log-file=INFO:04:43
wgrantWhy not?04:43
StevenKJobCronScript is used by process-job-source.py, scan_branches and a bunch of others.04:44
wgrantscan_branches etc. are irrelevant04:44
wgrantAll that matters is process-job-source.py04:44
wgrantAnd it would become the One True Runner04:44
wgrantSo JobCronScript would become a part of it04:44
wgrantdistroseriesdifference_job, merge-proposal-jobs, process-apport-blobs etc die04:45
StevenKwgrant: http://pastebin.ubuntu.com/5842443/04:45
StevenKAh, you're there.04:45
StevenKwgrant: Happy to start digging the graves for those scripts in a seperate branch.04:46
wgrantI'm doing that :)04:46
StevenKAh04:46
wgrantSo we'll be down to just process-job-source.py and celery as job runners.04:46
StevenKAnd it will be glorious04:46
wgrant(process-job-source-groups just launches multiple process-job-sources)04:47
StevenKwgrant: You do seem to have been distracted quite heavily from reviewing my branch, though. :-)04:49
wgrantStevenK: I was hoping you'd checked that process-job-source actually manages to run the job04:49
StevenKwgrant: As in IPackageDiffJob ?04:50
wgrantYes04:50
wgrantAh04:50
wgrantThere is a test, I see04:50
StevenKYes04:50
StevenKI don't need to check, I wrote a test to check for me.04:50
wgrantStevenK: Can you explain how the delegation for PackageDiffJobDerived works?04:51
wgrantself.context = self is slightly smelly04:51
StevenKself.context = self is for the benefit of celery who assumes that context is a job class04:52
wgrantIsn't that for the delegates()?04:52
StevenKNo, that's self.job04:52
StevenKjob is for delegates, context is for celery04:53
wgrantHow does delegate(IPackageDiffJob) know to look at self.job rather than self.context?04:53
wgrantAlso, what's that __storm_table__ doing there?04:53
StevenK__storm_table__ is there because celery calls IStore(db_class)04:54
wgrantRight, but db_class should be the Job in this case04:54
StevenKWith no __storm_table__, we can't adapt04:54
wgrantSure04:54
StevenKBecause the IStore adapter looks up a table04:54
wgrantBecause it's not a DB class.04:54
wgrantSo celery shouldn't be trying to use it as one04:54
wgrantThe DB class is Job04:55
StevenKRight, but it got handed a PackageDiffJob04:55
StevenKIt assumes all jobs it gets are DB backed04:55
wgrantThat's not a valid assumption04:55
wgrantIt could perhaps call a getDBObject method04:55
wgrantWe should fix the celery integration rather than faking a DB class.04:55
wgrantSince the celery integration is probably actually easier to change04:56
StevenKgetDBObject?04:57
wgrantA method on a job that returns the DB object.04:57
wgrantIt's an example of a way to fix this that isn't evil.04:57
StevenKI didn't think __storm_table__ wasn't so evil ... it's correct in one sense04:58
wgrantIt's not04:58
StevenKIt is, we have a row in the Job table about it.,04:59
wgrantThat's a very low threshold for correctness :)04:59
wgrantThe job system has enough hacks that we haven't removed yet; we should do the small amount of work needed to integrate this nicely, rather than piling on more. Particularly when the additional hacks have the side-effect of turning a normal object into a really strange faux-Storm object with consequences that I haven't fully determined yet.05:01
StevenKwgrant: Right, so we want it to be a classmethod that returns IStore(cls) for the base class, and PackageDiffJob can return IStore(Job) ?05:03
StevenKgetStore() or something05:04
wgrantStevenK: Um, possibly, I forget exactly how this is structured at the moment.05:04
wgrantStevenK: How does it work for non-Job-only jobs?05:04
wgranteg. BranchJobDerived isn't a Storm object05:05
wgrantIt still just delegates to BranchJob05:05
StevenKdb_class in this case is BranchJob05:05
StevenKOr so05:05
wgrantSure05:05
wgrantBut how does it get there?05:05
wgrantOh05:05
wgrantBecause celery is given a key of BranchJob?05:06
wgrantNot the concrete enumerated class?05:06
StevenKHm05:06
StevenKThe job classes themselves are db classes05:06
StevenKI thought they had a generic base class05:06
StevenKSo PackageDiffJob is the odd one out05:07
wgrantNot really, no05:07
wgrantBranchScanJob is a BranchJobDerived05:07
wgrantSo BranchScanJob isn't a DB class; it just delegates to BranchJob, which is one.05:07
wgrantPackageDiffJob is the same; it just delegates to a Job, which is one.05:07
StevenKSharingJob for instance, is StormBase05:07
wgrantSharingJob isn't equivalent to PackageDiffJob05:08
wgrantSharingJob is the DB class that underlies the concrete sharing jobs05:08
StevenKRight05:08
wgrantlib/lp/registry/model/sharingjob.py:class RemoveArtifactSubscriptionsJob(SharingJobDerived):05:08
StevenKIt backs onto SharingJobDerived, which is backed onto BaseRunnableJob05:08
wgrantExactlyu05:09
wgrantThe actual job classes are never Storm objects05:09
wgrantWhich is why it's completely wrong that PackageDiffJob is05:09
wgrantWhich is the line in celery that expects the job to be storm?05:09
wgrantI suspect it's just before it uses UniversalJobSource05:09
StevenKIt's in UniversalJobSource05:09
wgrantThe difference is the lack of makeDerived.05:09
wgrantFor traditional jobs, the key is ('BranchJob', id)05:10
wgrantIStore(BranchJob) works05:10
StevenKstore = IStore(db_class) in UniversalJobSource.get05:10
wgrantAnd the UniversalJobSource looks up the BranchJob by id05:10
wgrantOh!05:10
wgrantThat makes more sense :)05:10
wgrantSo it's not in the celery stuff05:10
StevenKIt's called by the celery stuff05:10
wgrantYeah05:11
wgrantBut I was wondering how celery could see this05:11
wgrantGiven that the bits that could break were in UJS05:11
wgrantSo05:11
wgrantEasy fix05:11
wgrantIf db_class isn't actually a DB class, assume Job05:11
wgrantSo UJS can take two different things05:11
wgrant 1) the traditional intermediate job DB class, like BranchJob or SharingJob, plus a Job.id05:12
wgrant 2) a Job-only job class, like PackageDiffJob, plus a Job.id05:12
StevenKwgrant: But __storm_table__ == 'Job05:12
wgrantIn 1) it uses BranchJob.makeDerived to get the concrete one05:12
StevenKIs how we do return db_class(db_job)05:12
wgrantStevenK: Only because you put it there to placate the code that we're replacing05:12
wgrantWhat do you mean?05:13
wgrant(also, db_class isn't a DB class in case 2, so it should probably be renamed)05:13
StevenKwgrant: IOW, I'm using __storm__table__ == 'Job' to work out if it's a fake job05:13
wgrantStevenK: Yes05:13
wgrantAnd instead you're going to work out if it's a Job-only (aka. fake) job by the *lack* of __storm_table__05:13
StevenKRigh05:14
StevenK*Right05:14
StevenKwgrant: http://pastebin.ubuntu.com/5842508/05:32
wgrantStevenK: Not fake, but represented in the database by only a Job row.05:35
wgrantThe two different inputs that the method takes are quite confusing to distinguish, so I'd suggest a few lines of comment there describing the two cases05:35
StevenKwgrant: http://pastebin.ubuntu.com/5842515/05:35
wgrantA good start05:38
StevenKwgrant: http://pastebin.ubuntu.com/5842531/05:41
wgrantStevenK: Heh, that doesn't quite describe the extraordinary oddness05:43
wgrantIn the Job-only case, the class name we are given is the concrete job05:43
wgrantIn the non-Job-only case, the class name we are given is the intermediate abstract job class05:43
StevenK        # - Jobs that have no backing, and are only represented by a row in05:44
StevenK        #   the Job table, but the class name we are given is the abstract05:44
StevenK        #   job class.05:44
wgrantSounds good05:45
StevenKwgrant: http://pastebin.ubuntu.com/5842539/ is the diff05:46
wgrantStevenK: One more thing I've just thought of... it possibly makes sense in PDJ.__init__ to assert that job.job_type matches what we expect05:47
wgrantJust in case anything funny happens and there's eg. an ID mixup due to a celery issue05:47
StevenKwgrant: Hm, we don't ignore FAILED diffs -- I don't think we can deal with that iterReady, so I guess we should have run() just return None if status != PENDING05:51
wgrantStevenK: Didn't we do something to handle that a couple of weeks ago?05:52
wgrantNot running jobs unless they are runnable05:52
wgrantOr do we in this case have a WAITING job for a FAILED diff?05:53
StevenKwgrant: The job *itself* will be runnable, some diffs will be created as FAILED -- eg: udev05:53
wgrantThat sounds like a bug05:53
wgrantThere should be no job in that case.05:53
StevenKwgrant: http://pastebin.ubuntu.com/5842550/05:56
wgrantStevenK: Right05:57
StevenKI'll be happy when that diff bug is fixed and we can rip that rubbish out05:58
StevenKwgrant: Any other concerns?05:58
wgrantI don't think so05:59
=== tasdomas_afk is now known as tasdomas
StevenKwgrant: Did you forget to remove all of the obsoleted cronscripts?09:44
wgrantStevenK: In a second branch10:06
wgrantStevenK: So we don't break everything ever when this rev is deployed10:06
StevenKNot everything ever, just most jobs. :-)10:07
=== tasdomas is now known as tasdomas_afk
=== tasdomas_afk is now known as tasdomas
=== tasdomas is now known as tasdomas_afk
xnoxWhy is https://launchpad.net/~costamagnagianfranco/+archive/firefox "firefox-backports" ?! building boinc on virt-arm ?!15:48
=== _mup__ is now known as _mup_
=== s1aden is now known as sladen

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!