Return-Path: X-Original-To: apmail-aurora-dev-archive@minotaur.apache.org Delivered-To: apmail-aurora-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 622F011EF3 for ; Mon, 21 Apr 2014 19:00:01 +0000 (UTC) Received: (qmail 35104 invoked by uid 500); 21 Apr 2014 19:00:00 -0000 Delivered-To: apmail-aurora-dev-archive@aurora.apache.org Received: (qmail 35043 invoked by uid 500); 21 Apr 2014 19:00:00 -0000 Mailing-List: contact dev-help@aurora.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@aurora.incubator.apache.org Delivered-To: mailing list dev@aurora.incubator.apache.org Received: (qmail 35035 invoked by uid 99); 21 Apr 2014 19:00:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Apr 2014 19:00:00 +0000 X-ASF-Spam-Status: No, hits=-0.5 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of yasumoto7@gmail.com designates 209.85.160.43 as permitted sender) Received: from [209.85.160.43] (HELO mail-pb0-f43.google.com) (209.85.160.43) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Apr 2014 18:59:53 +0000 Received: by mail-pb0-f43.google.com with SMTP id um1so4038294pbc.30 for ; Mon, 21 Apr 2014 11:59:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=xNphb90w1DSIBrUPwRW0LRlxvnTd7Uj2SJMDlu7eTaM=; b=zua43fN/+9JhDsIvPP9+irP719KyhrYNIJbyxVQLz3HbjWUe+E0fmAfKRZf0eY355k KapVz1vs2G1N+anSrObgRBlteMmXrLW61jcsGnvMy9JzH2k1XhihLeT7hNnQZuf9+qS6 qpJ6o40frB64ZMRfpNkYOapQcDApDU/PgZf6OxLf/r8V32B3Ns0JOwYiB2zM1+5cbgqJ bZJyTNqWoqXzBe6RJvP+eLxOzzdByXhJg1u1mDw3kVK5h0wUU/JNk/YzCU3uhQxddZd8 oFwT0yVGYWuD1w3/yZbBgDDB6dIbKbyDNMnoGsQOUFE1mNnnE5GLcVF6BcH3NtNyZJsd /hLA== X-Received: by 10.66.234.10 with SMTP id ua10mr33270013pac.92.1398106773158; Mon, 21 Apr 2014 11:59:33 -0700 (PDT) Received: from tw-172-25-20-192.office.twttr.net ([8.25.197.24]) by mx.google.com with ESMTPSA id pb7sm190104716pac.10.2014.04.21.11.59.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Apr 2014 11:59:32 -0700 (PDT) Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) Subject: Re: Client Configuration Plugin Extension Proposal From: Joseph Smith In-Reply-To: Date: Mon, 21 Apr 2014 11:56:17 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <51B6AA22-3501-4FDE-B0D6-C7886913E68F@gmail.com> References: <7970016C-D321-4BCF-99F5-22C3FA832EF8@gmail.com> To: dev@aurora.incubator.apache.org X-Mailer: Apple Mail (2.1874) X-Virus-Checked: Checked by ClamAV on apache.org Yep, that summarizes my thinking as well. #ship On Apr 18, 2014, at 2:28 PM, Mark Chu-Carroll = wrote: > No, I don't think that there are any other reasonable call-points. In = fact, > I'm not sure if three is too many, but I'm pretty sure that more = would be > a sign that this design isn't right. >=20 > -mark >=20 >=20 >=20 >=20 > On Fri, Apr 18, 2014 at 5:24 PM, Joseph Smith = wrote: >=20 >> I think this sounds reasonable- do you foresee there being any = additions >> here? I'm not sure there'd be any more call-points, so it seems like = a good >> way to move forward by adding flexibility. >>=20 >> On Apr 18, 2014, at 2:15 PM, Mark Chu-Carroll = >> wrote: >>=20 >>> I'm contemplating making a change to the current configuration = plugins. >> I'd >>> like to get a couple of other eyes to glance over it - I'm unsure = whether >>> this is sound, or just a reaction to an immediate problem that I >>> encountered working on logging. >>>=20 >>> The way that configuration plugins work right now in the noun/verb >>> framework is super simple. A configuration plugin is an object with = an >>> "execute" method. During command dispatch, after the command parser >>> processes the arguments and a command-appropriate context is = created, >> the >>> framework iterates over the plugins, and calls the execute method of = each >>> one, with the context object and parsed command line parameters. >>>=20 >>> There are two problems that I've encountered working with these in >> practice: >>>=20 >>> 1. Some plugins really want to be run before the command-line = arguments >>> are processed, and some want to be run after. For example, for a >>> distributed logging system, we'd like to be able to have the = logging >> system >>> optionally enabled before the command is dispatched, so that the >> dispatch >>> process can use logging. But others, for managing things like = proxies, >> need >>> to be called after arguments are processed, because they rely on >> arguments. >>> 2. Some plugins need cleanups. For example, in logging again, for = best >>> performance, we'd like to use multiprocessing to do asynchronous >>> communication with a logserver. But to do that, we need to do a = join >> after >>> the command completes execution. In the current framework, there's = no >> way >>> to do that. >>>=20 >>> What I'm thinking about is going more aspect-oriented in the = plugins. >> There >>> will be three points during the execution of a command where plugins = can >>> get injected: >>>=20 >>> 1. before any argument processing is performed. The only thing that = the >>> plugin would be allowed to look at would be the raw, unprocessed >>> command-line parameters. It would return a (potentially) modified = copy >> of >>> the parameters, which would be passed to other plugins, and finally = to >> the >>> actual noun/verb for the command being executed. >>> 2. after arguments have been processed, but before the noun/verb is >>> executed. This is exactly what the current plugin "execute" method >> does. >>> 3. after the command has completed executing, but before the client >>> exits. >>>=20 >>> The code signatures would be: >>>=20 >>> def beforeDispatch(self, args): >>> """code to execute before dispatching to a noun/verb command. >>> args: a list of the command-line parameters used >>> to invoke aurora. >>> Returns: a possibly modified list of command-line arguments. = If >>> this throws an exception, then the execution >>> of the command will be aborted. >>> """ >>>=20 >>> def beforeCommand(self, context): >>> """Code to execute after command-line arguments have been >>> processed, but before executing the command. If the >>> code throws a CommandException, then the execution of >>> the command will be aborted. >>> context: the context object that will be used to invoke >>> the command. >>>=20 >>>=20 >>> def cleanupAfterCommand(self, context, returnval): >>> """Code to run after the execution of a noun/verb command has >>> completed, before the command-line application exits. >>> context: the context object that was used to execute the = command. >>> returnval: the exit code returned by executing the command. >>> """ >>>=20 >>>=20 >>> The order of execution of plugins would remain undefined. >>=20 >>=20