|
From: Robert E. <pa...@tu...> - 2004-02-10 07:09:30
|
> OK, I had failed to understand that. It certainly sounds useful, but it
> doesn't really match anything *I* expect to need. I would expect to have more
> of a situation where I ask for 1000 CRApplicationNodes and 64 CRNetworkNodes
> and don't care what their hostnames are (subject to some constraints; see
> below). I could generate 1064 unique strings starting with '#', but it seems
> pretty awkward. I'm wondering if there is a way to specify my setup without
> the extra strings.
You'd have to generate the unique nodes, anyway, right? I'd imagine a config
file something like:
for appNodeNumber in range(NUM_APPNODES):
appNode = CRApplicationNode("#appnode%d" % appNodeNumber)
cr.AddNode(appNode)
Shouldn't be any more complex than any other way to set up a large number of
similar nodes (and still a heckuva lot easier than providing the individual
names of each node).
> It begins to seem like the original specification was wrong, and
> CRNetworkNode() shouldn't take a string at all. Rather, one might have done
> something like:
>
> import re
> anyPSCHost= re.compile('.*\.psc\.edu')
> node1= CRNetworkNode()
> node2= CRNetworkNode()
> node3= CRNetworkNode()
> node4= CRNetworkNode()
>
> node2.addConstraint('match_string', 'somenode.psc.edu' )
> node3.addConstraint('match_regex', anyPSCHost)
> node4.addConstraint('same_host_as',node1)
>
> node1 could be assigned to any hostname, node2 would match only
> somenode.psc.edu, node3 would require a hostname matching the AnyPSCHost
> regex, and node4 would match only the host assigned to node1. I believe the
> 'isinstance' problem is avoided here because the initial string essentially
> specifies the type of the second argument. Oh, note that I haven't said
> 'node2.Conf(...)' because it doesn't really configure the *node*; it only
> configures the host matching logic within the mothership.
It does some yucky things if, using the example above, node4 happens to contact
the mothership before node1 does. We'd need to parse trees of constraints (in
general) to resolve "same_host_as", and we'd have to be able to handle circular
references...
It also becomes more difficult to specify and handle some relatively simple
cases; and can produce interesting results if someone unwittingly comments out
or deletes a constraint line (when all of a sudden the network node begins
acting like it's constrained to "localhost" instead of being dynamic).
The above *is* a clever generalization that's functionally equivalent to my
original and avoids the new "#" syntactic element; but it seems to me to be
difficult to fit into the current paradigm (with all its backwards-compatible
behavioral quirks) cleanly, without introducing more confusion and/or need for
wizards and gurus to create config files...
Bob
|