Page MenuHomePhabricator

Unify the local and global view for `./bin/phd status`.
ClosedPublic

Authored by joshuaspence on Jun 17 2014, 9:01 PM.
Tags
None
Referenced Files
F13096976: D9607.id23059.diff
Thu, Apr 25, 8:14 PM
F13096975: D9607.id23058.diff
Thu, Apr 25, 8:14 PM
F13096974: D9607.id23056.diff
Thu, Apr 25, 8:13 PM
F13096973: D9607.id23047.diff
Thu, Apr 25, 8:13 PM
F13096972: D9607.id23046.diff
Thu, Apr 25, 8:13 PM
F13096971: D9607.id23044.diff
Thu, Apr 25, 8:13 PM
F13096970: D9607.id23043.diff
Thu, Apr 25, 8:13 PM
F13096969: D9607.id23041.diff
Thu, Apr 25, 8:13 PM
Subscribers

Details

Summary

Ref T4209. Unifies the local (./bin/phd status) and global (./bin/phd status --all) view into a single table. This generally makes it easy to administer daemons running across multiple hosts.

Depends on D9606.

Test Plan
> sudo ./bin/phd status 
ID Host      PID  Started                 Daemon                               Arguments
38 localhost 2282 Jun 18 2014, 7:52:56 AM PhabricatorRepositoryPullLocalDaemon          
39 localhost 2289 Jun 18 2014, 7:52:57 AM PhabricatorGarbageCollectorDaemon             
40 localhost 2294 Jun 18 2014, 7:52:57 AM PhabricatorTaskmasterDaemon                   
41 localhost 2314 Jun 18 2014, 7:52:58 AM PhabricatorTaskmasterDaemon                   
42 localhost 2319 Jun 18 2014, 7:52:59 AM PhabricatorTaskmasterDaemon                   
43 localhost 2328 Jun 18 2014, 7:53:00 AM PhabricatorTaskmasterDaemon                   
44 localhost 2354 Jun 18 2014, 7:53:08 AM PhabricatorRepositoryPullLocalDaemon X --not Y

Diff Detail

Repository
rP Phabricator
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

joshuaspence retitled this revision from to Unify the local and global view for `./bin/phd status`..
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.
joshuaspence edited edge metadata.
  • Minor fixes
  • Remove formatting
  • Fix for possible undefined variable
epriestley edited edge metadata.
epriestley added inline comments.
src/applications/daemon/query/PhabricatorDaemonLogQuery.php
28–32 ↗(On Diff #23029)

(These changes appear elsewhere?)

This revision is now accepted and ready to land.Jun 17 2014, 10:08 PM
src/applications/daemon/query/PhabricatorDaemonLogQuery.php
28–32 ↗(On Diff #23029)

Diffed against master instead of D9606.

joshuaspence added inline comments.
src/applications/daemon/management/PhabricatorDaemonManagementStatusWorkflow.php
56

I forgot that I hadn't yet implemented this... thoughts on how to tackle this?

src/applications/daemon/management/PhabricatorDaemonManagementStatusWorkflow.php
56

The issue is that the DB version is too verbose?

I think either adding a method to PhabricatorDaemonLog like getInterestingArgv() and filtering there, or adding a new column and inserting only the interesting stuff are both reasonable approaches.

Although it looks like we aren't GC'ing this table, so maybe we should do that before schema mutations. So I guess I slightly favor:

  • Add getInterestingArgv() or similar for now and just filter with a regexp.
  • If you want to pursue filtering when the record is inserted eventually, add GC for this table (maybe I'll just shoot you a diff for this).
  • After GC has been in for a while, mutate the table freely.
  • Or, I think you could safely change the code to insert only the interesting arguments, but it seems somewhat valuable to retain the entire original argv.

We only have ~16K rows on secure.phabricator.com and are probably near the high end of all installs (i.e., we run the normal number of daemons but probably restart way more often than most installs do) so if you really want to mutate the table that's probably fine to do today without waiting for the GC to clean things up in the wild.

joshuaspence edited edge metadata.

Add interestingArgv column to phabricator_daemon.daemon_log

This revision is now accepted and ready to land.Jun 17 2014, 10:46 PM
joshuaspence edited edge metadata.
joshuaspence added inline comments.
resources/sql/autopatches/20140617.daemonlog.sql
1–2 ↗(On Diff #23041)

Actually, renaming this is a bad idea.

resources/sql/autopatches/20140617.daemonlog.sql
1–2 ↗(On Diff #23041)

yes plz no rename

These patches don't need to apply in order so the new one can be called whatever.

joshuaspence edited edge metadata.
  • Small fix
  • interestingArgv can be null

Seems fine, modulo one inline, depending on how you do the implementation.

src/applications/daemon/storage/PhabricatorDaemonLog.php
22–24

(Should interestingArgv also have JSON serialization?)

src/applications/daemon/storage/PhabricatorDaemonLog.php
22–24

Yeah, probably. Will fix.

  • Changed my mind... interestingArgv shouldn't be null.
  • loadAvailableDaemons is used in other places
epriestley edited edge metadata.
This revision is now accepted and ready to land.Jun 17 2014, 11:24 PM
joshuaspence edited edge metadata.

Last change, I swear!

@epriestley, before I land this... I don't suppose there is a better name than interestingArgv? I'm not a huge fan TBH.

That'll do. The more terms I read interestingArgv the more I disliked it.

Change interestingArgv to explicitArgv

joshuaspence edited edge metadata.

Just being super cautious (paranoid?) and making sure this still all walks. I'll do a quick test on my dev box too.

(Seems to work fine from my tests)

epriestley edited edge metadata.
epriestley added inline comments.
src/applications/daemon/management/PhabricatorDaemonManagementStatusWorkflow.php
74

Not really relevant, but this phutil_console_format() is a bit fluff.

src/infrastructure/daemon/control/PhabricatorDaemonReference.php
15–20

This could be slightly simplified with phutil_json_decode().

This revision is now accepted and ready to land.Jun 18 2014, 1:30 AM
joshuaspence edited edge metadata.

Minor changes as per @epriestley's comments

joshuaspence updated this revision to Diff 23059.

Closed by commit rPf52fbf61170d (authored by @joshuaspence).