Merge lp://staging/~robru/bileto/publish-job into lp://staging/bileto

Proposed by Robert Bruce Park
Status: Merged
Merged at revision: 680
Proposed branch: lp://staging/~robru/bileto/publish-job
Merge into: lp://staging/bileto
Diff against target: 940 lines (+459/-54)
17 files modified
Makefile (+3/-1)
bileto/actions.py (+6/-2)
bileto/static/index.html (+1/-1)
bileto/streams.py (+3/-0)
bileto/templates/loglist.html (+3/-0)
bileto/worker/manager.py (+33/-7)
bileto/worker/manual.py (+11/-0)
bileto/worker/merge.py (+10/-2)
bileto/worker/package.py (+124/-14)
files/rsyncd.conf (+7/-0)
scripts/vcs.sh (+5/-7)
tests/test_actions.py (+3/-8)
tests/test_streams.py (+18/-0)
tests/test_worker_manager.py (+71/-11)
tests/test_worker_manual.py (+28/-0)
tests/test_worker_merge.py (+11/-1)
tests/test_worker_package.py (+122/-0)
To merge this branch: bzr merge lp://staging/~robru/bileto/publish-job
Reviewer Review Type Date Requested Status
Robert Bruce Park (community) Approve
Martin Pitt Needs Fixing
Review via email: mp+302105@code.staging.launchpad.net

Commit message

Implement publish job in Bileto, obsoleting jenkins entirely.

Description of the change

(note this depends on charm changes and must be deployed with "mojo upgrade-charm")

To post a comment you must log in.
703. By Robert Bruce Park

Temporarily disable some checks for testing.

704. By Robert Bruce Park

Temporarily disable some more checks for testing.

705. By Robert Bruce Park

Temporarily disable even more checks for testing.

706. By Robert Bruce Park

Fix publishing.

707. By Robert Bruce Park

Re-enable all checks.

Revision history for this message
Martin Pitt (pitti) wrote :

Mostly code style issues and nitpicks, but two or three more serious issues.

review: Needs Fixing
Revision history for this message
Robert Bruce Park (robru) wrote :

Replies inline,thanks Martin

Revision history for this message
Martin Pitt (pitti) wrote :

Answered to your replies, thanks!

The flashplugin-nonfree component issue is still a blocker. The rsync race looks like an actual bug, but not that important (so not a blocker). Do with the code style/obfuscation comments what you want.

Revision history for this message
Robert Bruce Park (robru) :
708. By Robert Bruce Park

Rename __getattr__ to call_on_all_packages for pitti.

709. By Robert Bruce Park

Ensure os.rename() stays within filesystem.

710. By Robert Bruce Park

Clarify docstring.

Revision history for this message
Robert Bruce Park (robru) wrote :

Ok I've pushed commits to resolve the issues I agree with, I'm choosing not to block on the two things that are historical cruft that I've inherited (flashplugin-nonfree/universe and '0 means no version'), I'm open to revisiting those later but for now those things work and are already production-proven, and I need to move forward with this rollout. Thanks for the review Martin!

review: Approve
711. By Robert Bruce Park

Fix tests.

Revision history for this message
Martin Pitt (pitti) wrote :

Robert Bruce Park [2016-08-22 16:06 -0000]:
> Can you elaborate what you mean by "recursively call the method on its direct children"?

Well, I don't know what this is doing, but you said that __getattr__()
has some magic to do that kind of iteration.

> The reason that __getattr__ is defined to pass methods down to
> children is that this is called from dozens of places (and many of
> those cases it isn't overloaded at all, it's just a direct pass
> through), so I'm not going to reimplement that in every single place
> that needs to pass through. I'll probably rename __getattr__() to
> call_on_all_packages().

Doing "__getattr__ = call_on_all_packages" and replacing half of the
calls with the other makes things even *more*
confusing/implicit/surprising, so better revert that bit or fix it
consistently.

> There is an rsync server running continuously on the bileto
> instance, and snakefruit polls it every 5 minutes looking for a new
> file to read. Bileto doesn't "start" rsync.

So I suggest using a lock file (in both the rsync process and bileto)
to ensure to not run rsync while bileto is updating that file tree.
Another common pattern is to do something like this:

  cp -al cur_tree new_tree
  <change new_tree>
  mv cur_tree old_tree; mv new_tree cur_tree

You can't atomically rename an existing (non-empty) directory, but at
least this is fairly quick and thus will work in almost every case.
However, lock files are cheaper, simpler, and completely robust.

> As I said this was decided by infinity and I'm not sure what would be correct.

Please ask him again what this should mean and add a big fat comment
about it. The concept of "upload flashplugin-nonfree into universe"
simply does not make sense -- asking questions about it might be some
weird LP quirk, but it should at least be documented. You yourself
don't even know what it does any more :-)

Revision history for this message
Robert Bruce Park (robru) wrote :
Download full text (4.5 KiB)

On Aug 22, 2016 10:15 PM, "Martin Pitt" <email address hidden> wrote:
>
> Robert Bruce Park [2016-08-22 16:06 -0000]:
> > Can you elaborate what you mean by "recursively call the method on its
direct children"?
>
> Well, I don't know what this is doing, but you said that __getattr__()
> has some magic to do that kind of iteration.

So a ticket can have many packages. When you "build a ticket" you want to
build each package. The manager class exists to ensure the classes
representing the packages are correctly instantiated and then passes
messages back and forth. So when you call manager.build() you're really
calling .build() on every package instance. Manager.__gettattr__() contains
the logic for calling the method, in parallel, on each instance.

In some cases there's some "global" logic that operates once on the whole
ticket rather than per package, and that's where you see those manager
methods that call __getattr__, they're processing the return values that
came back from each package, etc. But there are other cases where you might
call "manager.foo()" and foo doesn't exist at all, it goes straight to
package.foo() on each package. The idea was that the manager is a sort of
transparent wrapper around the package instances, you can call package
methods on it and it passes the calls down to each instance. Eg, it's an
explicit design goal that you would often call methods on the manager
instance that do not exist, which is why __getattr__ is defined. It's just
unfortunate that so many methods require a bit of intervention before /
after the __getattr__ logic that you see so many methods calling
__gettattr__ with their own method name.

>
> > The reason that __getattr__ is defined to pass methods down to
> > children is that this is called from dozens of places (and many of
> > those cases it isn't overloaded at all, it's just a direct pass
> > through), so I'm not going to reimplement that in every single place
> > that needs to pass through. I'll probably rename __getattr__() to
> > call_on_all_packages().
>
> Doing "__getattr__ = call_on_all_packages" and replacing half of the
> calls with the other makes things even *more*
> confusing/implicit/surprising, so better revert that bit or fix it
> consistently.

What do you mean replacing half the calls? Nothing is calling
"self.__getattr__()" any longer so it's perfectly consistent. __getattr__
is kept for the cases when a nonexistent method is called on the manager
class. That has to stay because they chain together, eg, you can call
"manager.foo().bar()" and that calls foo and bar on all package instances.
Getting rid of __getattr__ would result in code like
"manager.call_on_all_packages('foo').call_on_all_packages('bar')", eg,
redundant slop.

>
> > There is an rsync server running continuously on the bileto
> > instance, and snakefruit polls it every 5 minutes looking for a new
> > file to read. Bileto doesn't "start" rsync.
>
> So I suggest using a lock file (in both the rsync process and bileto)
> to ensure to not run rsync while bileto is updating that file tree.
> Another common pattern is to do something like this:
>
> cp -al cur_tree new_tree
> <change new_tree>
> mv cur_t...

Read more...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches