[gold-users] Antwort: Re: Changing debit order possible?
Scott Jackson
scottmo at adaptivecomputing.com
Thu Jul 8 12:59:30 MDT 2010
Richard,
Yes, it is hardcoded from the following:
The account weight is calculated by:
# We need to rank accounts by how specific they are
my $weight =
100 * generality($accountProject) +
10 * generality($accountUser) +
generality($accountMachine);
if (! exists $accounts{$accountId}
|| $weight < $accounts{$accountId})
{
$accounts{$accountId} = $weight;
}
Where
# Get generality
sub generality
{
my ($entity) = @_;
if ($entity eq "ANY") { return 3; }
elsif ($entity eq "MEMBERS") { return 2; }
else { return 1; }
}
The allocation weight is then calculated by:
$allocations{$allocationId}{weight} =
$distance * $allocationEndTime + $accounts{$accountId};
And the final sorting is done by:
my @allocations =
sort { $allocations{$a}{weight} <=> $allocations{$b}{weight} }
keys %allocations;
# Iterate through the allocation list
foreach my $allocationId (@allocations)
{
# Make maximum possible debits, etc.
...
}
Thanks,
Scott
RNothdurft at spirit21.de wrote:
> Hi Scott,
>
> ok, that's a very simple but effective solution ;)
>
> So the debit order is hard coded, or?
>
> Thanks for the advice,
> Richard
>
>
>
>
>
> >
> > Richard,
> >
> > That is an interesting issue. My best off the cuff answer would be to
> > make the credit account expire one minute later than the debit account.
> > That would probably accomplish what you want since earliest expiring is
> > the highest precedence qualifier (if the admin credit account is
> tied to
> > the same project, then a minute difference would suffice. If it is tied
> > to ANY project, then offset it by 10 minutes.)
> >
> > Thanks,
> >
> > Scott
> >
> > RNothdurft at spirit21.de wrote:
> > > Hi again,
> > >
> > > I've run into the next problem. As on page 32 of the userguide "Gold
> > > will debit allocations in the order of earliest expiring and
> > > most specific first." In general situation this order makes sence,
> but
> > > is there a possibility to change it?
> > >
> > > I'll show you why with following scenario:
> > > - i've got a project with 3 users, one of them is admin
> > > - the project has got a budget of 100000 credits
> > > - the project admin is allowed to spend additional 10000 credits on
> > > credit, but only if the other project-budget is exhausted
> > >
> > > So i wanted to use 2 accounts to map it to GOLD, one for the admin
> > > with 0 credits, but 10000 as credit option and the other one for all
> > > project members with the whole budget of 100000 credits.
> > > As you now may see, if the admin is submitting a job, his
> > > corresponding account is getting negativ, instead of GOLD is using
> the
> > > shared account.
> > >
> > > I know as admin he's able to transfer the missing credits back to his
> > > account, but is there nevertheless a possiblity to do this without
> > > such a workaround?
> > >
> > > Thanks for any suggestions.
> > >
> > > Kind regards,
> > > Richard
> > >
> > >
>
> Richard Nothdurft
> DHBW-Student der SPIRIT/21 AG
> Otto-Lilienthal-Str. 36, 71034 Böblingen
> Mobil: 0177/7427024
> E-Mail: rnothdurft at spirit21.de
> Internet: http://www.spirit21.de <http://www.spirit21.de/>
>
>
> SPIRIT/21 AG
>
> Sitz der Gesellschaft: Böblingen
> Vorstand: Dietmar Wendt (Vorsitzender), Philipp Steffen, Joachim Gutheil
> Vorsitzender des Aufsichtsrates: Siegfried J. Althaus
> Registergericht: Amtsgericht Stuttgart, Registernummer: HRB 244681
> Umsatzsteuer-Identifikationsnummer: DE 198412560
> ------------------------------------------------------------------------
>
> _______________________________________________
> gold-users mailing list
> gold-users at supercluster.org
> http://www.supercluster.org/mailman/listinfo/gold-users
>
More information about the gold-users
mailing list