golemfactory/golem-core-python

Identify `yapapi` dependencies to be moved/ported into `golem-core`

Closed this issue · 1 comments

As golem-core reached its MVP, we should follow up its state with already existing yapapi. As its not currently known if we want to merge those projects, or keep them separate, we know that we need to get rid of yapapi dependency in golem-core. golem-core should take role of the lowest python level library, so no yapapi dependencies should exists.

As list of dependencies is not yet known, we decided that we need first to check the golem-core codebase, and list all of yapapi dependencies.

To do:

  • Prepare list of yapapi modules/classes/flows that are used by golem-core for later replacement

Bits

  • Note: check both yapapi's version for each bit (^0.9.3 and newest)
  • Copy blender image source code (used in examples) from yapapi to golem-core-python
  • Port/reimplemnt Payload along with yapapi.payload.vm and other yapapi.payload artifacts in golem-core:
    • TODO investigate what golem-core uses this for se we can port less code
      • what is the reason AutodecoratingModel exists?
      • is there a reason to mix properties and constrains as a collection on the same level (instead of having two separated collections)?
    • refactor golem-core's Package.from_image_hash so it doesn't spin asyncio event loop
    • refactor yappai's Package.resolve_url() so it returns plain url instead of str decorated with prefix and sufix
  • Copy GftpProvider to golem-core, limit it to only classes and functions necessary for golem-core (e.g. Destination and Source abstract classes)
  • Copy _YagnaDatetimeFormatter to golem-core
  • Port/reimplement rest.Configuration
    • change name so it reflects what it dose
    • change factory methods names so they reflect what they are doing
    • Copy yapapi/config.py:ApiConfig and add logic resposible for creating default ya_ urls.
    • Create factories that will return specific ya_ clients based on given ApiConfig
      • Replace self._api_config.market() calls with calls to new factory. e.g.:
        self._ya_market_api = ApiFactory(self._api_config).create_market_api()
  • Copy DEFAULT_DRIVER, DEFAULT_NETWORK, DEFAULT_SUBNET to golem-core
  • Refactor golem_node.GolemNode.create_demand so it doesn't use yapapi's DemandBuilder nor props
  • Copy fstring from __str__ method from NoPaymentAccountError to NoMatchingAccount
  • Copy is_intermittent_error
  • Copy _is_gsb_endpoint_not_found_error