Skip to content

Module yapapi.runner

Sub-modules

Variables

CFF_DEFAULT_PRICE_FOR_COUNTER
CFG_INVOICE_TIMEOUT
SCORE_NEUTRAL
SCORE_REJECTED
SCORE_TRUSTED
TaskData
TaskEvents
TaskResult

Classes

DummyMS

class DummyMS(
    max_for_counter:Mapping[yapapi.props.com.Counter, decimal.Decimal]=mappingproxy({<Counter.TIME: 'golem.usage.duration_sec'>: Decimal('0.002'), <Counter.CPU: 'golem.usage.cpu_sec'>: Decimal('0.020')}),
    max_fixed:decimal.Decimal=Decimal('0.05')
)

DummyMS(max_for_counter:Mapping[yapapi.props.com.Counter, decimal.Decimal]=mappingproxy({: Decimal('0.002'), : Decimal('0.020')}), max_fixed:decimal.Decimal=Decimal('0.05'))

Ancestors (in MRO)

  • yapapi.runner.MarketStrategy
  • abc.ABC

Class variables

max_fixed
max_for_counter

Methods

decorate_demand
def decorate_demand(
    self,
    demand:yapapi.props.builder.DemandBuilder
) -> None
score_offer
def score_offer(
    self,
    offer:yapapi.rest.market.OfferProposal
) -> float

Engine

class Engine(
    *,
    package:'Package',
    max_workers:int=5,
    timeout:datetime.timedelta=datetime.timedelta(0, 300),
    budget:Union[float, decimal.Decimal],
    strategy:yapapi.runner.MarketStrategy=DummyMS(max_for_counter=mappingproxy({<Counter.TIME: 'golem.usage.duration_sec'>: Decimal('0.002'), <Counter.CPU: 'golem.usage.cpu_sec'>: Decimal('0.020')}), max_fixed=Decimal('0.05')),
    subnet_tag:Union[str, NoneType]=None
)

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as::

class Mapping(Generic[KT, VT]): def getitem(self, key: KT) -> VT: ... # Etc.

This class can then be used as follows::

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default

Ancestors (in MRO)

  • typing.AsyncContextManager
  • typing.Generic

Methods

map
def map(
    self,
    worker:Callable[[yapapi.runner.ctx.WorkContext, AsyncIterator[_ForwardRef('Task')]], AsyncIterator[Tuple[_ForwardRef('Task'), yapapi.runner.ctx.Work]]],
    data,
    event_emitter:yapapi.runner.events.EventEmitter=<function log_event at 0x7f860e784730>
)

LeastExpensiveLinearPayuMS

class LeastExpensiveLinearPayuMS(
    expected_time_secs:int=60
)

LeastExpensiveLinearPayuMS(expected_time_secs:int=60)

Ancestors (in MRO)

  • yapapi.runner.MarketStrategy
  • abc.ABC

Methods

decorate_demand
def decorate_demand(
    self,
    demand:yapapi.props.builder.DemandBuilder
) -> None
score_offer
def score_offer(
    self,
    offer:yapapi.rest.market.OfferProposal
) -> float

MarketStrategy

class MarketStrategy(
    /,
    *args,
    **kwargs
)

Abstract market strategy

Ancestors (in MRO)

  • abc.ABC

Descendants

  • yapapi.runner.DummyMS
  • yapapi.runner.LeastExpensiveLinearPayuMS

Methods

decorate_demand
def decorate_demand(
    self,
    demand:yapapi.props.builder.DemandBuilder
) -> None
score_offer
def score_offer(
    self,
    offer:yapapi.rest.market.OfferProposal
) -> float

Package

class Package(
    /,
    *args,
    **kwargs
)

Helper class that provides a standard way to create an ABC using inheritance.

Ancestors (in MRO)

  • abc.ABC

Descendants

  • yapapi.runner.vm._VmPackage

Methods

decorate_demand
def decorate_demand(
    self,
    demand:yapapi.props.builder.DemandBuilder
)
resolve_url
def resolve_url(
    self
) -> str

Task

class Task(
    data:~TaskData,
    *,
    expires:Union[datetime.datetime, NoneType]=None,
    timeout:Union[datetime.timedelta, NoneType]=None
)

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as::

class Mapping(Generic[KT, VT]): def getitem(self, key: KT) -> VT: ... # Etc.

This class can then be used as follows::

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default

Ancestors (in MRO)

  • typing.Generic

Instance variables

data
expires
output

Methods

accept_task
def accept_task(
    self,
    result:Union[~TaskResult, NoneType]=None
)
reject_task
def reject_task(
    self,
    reason:Union[str, NoneType]=None
)

TaskStatus

class TaskStatus(
    /,
    *args,
    **kwargs
)

An enumeration.

Ancestors (in MRO)

  • enum.Enum

Class variables

ACCEPTED
REJECTED
RUNNING
WAITING
name
value