Skip to content

Commit

Permalink
Address CR suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
azawlocki committed May 21, 2021
1 parent 1973569 commit a2e5c2d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion examples/blender/blender.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
import sys

from yapapi import (
Golem,
NoPaymentAccountError,
Task,
__version__ as yapapi_version,
WorkContext,
windows_event_loop_fix,
)
from yapapi.executor import Golem
from yapapi.log import enable_default_logger, log_summary, log_event_repr # noqa
from yapapi.payload import vm
from yapapi.rest.activity import BatchTimeoutError
Expand Down
1 change: 1 addition & 0 deletions yapapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
CaptureContext,
ExecOptions,
Executor,
Golem,
NoPaymentAccountError,
Task,
WorkContext,
Expand Down
17 changes: 4 additions & 13 deletions yapapi/executor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def unpack_work_item(item: WorkItem) -> Tuple[Work, ExecOptions]:


exescript_ids: Iterator[int] = itertools.count(1)

"""An iterator providing unique ids used to correlate events related to a single exe script."""

D = TypeVar("D") # Type var for task data
R = TypeVar("R") # Type var for task result
Expand Down Expand Up @@ -148,8 +148,7 @@ def __init__(
:param app_key: optional Yagna application key. If not provided, the default is to
get the value from `YAGNA_APPKEY` environment variable
"""
self._init_api(app_key)

self._api_config = rest.Configuration(app_key)
self._budget_amount = Decimal(budget)
self._budget_allocations: List[rest.payment.Allocation] = []

Expand Down Expand Up @@ -206,13 +205,6 @@ async def create_demand_builder(
await builder.decorate(self.payment_decoration, self.strategy, payload)
return builder

def _init_api(self, app_key: Optional[str] = None):
"""
initialize the REST (low-level) API
:param app_key: (optional) yagna daemon application key
"""
self._api_config = rest.Configuration(app_key)

@property
def driver(self) -> str:
return self._driver
Expand Down Expand Up @@ -265,7 +257,7 @@ def report_shutdown(*exc_info):
self._services.add(self._process_invoices_job)
self._services.add(loop.create_task(self.process_debit_notes()))

self._storage_manager = await self._stack.enter_async_context(gftp.provider())
self._storage_manager = await stack.enter_async_context(gftp.provider())

return self
except:
Expand Down Expand Up @@ -1159,5 +1151,4 @@ async def worker_starter() -> None:
"%s still running: %s", pluralize(len(pending), "service"), pending
)
except Exception:
# TODO: add message
logger.debug("TODO", exc_info=True)
logger.debug("Got error when waiting for services to finish", exc_info=True)

0 comments on commit a2e5c2d

Please sign in to comment.