Skip to content

Commit

Permalink
chore: code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
kamirr committed Sep 12, 2024
1 parent c743d3f commit cdcf38a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions examples/transfer-progress/progress.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3

from utils import build_parser, run_golem_example
import asyncio
import os
import pathlib
Expand All @@ -12,8 +13,8 @@

import yapapi.script.command
from yapapi import Golem
from yapapi.payload import vm, Payload
from yapapi.payload.vm import _VmPackage, VmRequest, VmPackageFormat
from yapapi.payload import Payload, vm
from yapapi.payload.vm import VmPackageFormat, VmRequest, _VmPackage
from yapapi.props import inf
from yapapi.props.base import constraint
from yapapi.props.builder import DemandBuilder
Expand All @@ -23,8 +24,6 @@
examples_dir = pathlib.Path(__file__).resolve().parent.parent
sys.path.append(str(examples_dir))

from utils import build_parser, run_golem_example


def command_key(event: "yapapi.events.CommandProgress") -> str:
return f"{event.script_id}#{event.command._index}"
Expand Down Expand Up @@ -100,7 +99,8 @@ class ExamplePayload(Payload):
"golem.runtime.capabilities", operator="=", default_factory=list
)

runtime: str = constraint(inf.INF_RUNTIME_NAME, operator="=", default=vm.RUNTIME_VM)
runtime: str = constraint(inf.INF_RUNTIME_NAME,
operator="=", default=vm.RUNTIME_VM)

# Constraints can't be bool, because python serializes bool to `True` and market matcher
# expects `true`.
Expand All @@ -114,7 +114,8 @@ class ExamplePayload(Payload):
async def decorate_demand(self, demand: DemandBuilder):
await super().decorate_demand(demand)
demand.add(
VmRequest(package_url=self.image_url, package_format=VmPackageFormat.GVMKIT_SQUASH)
VmRequest(package_url=self.image_url,
package_format=VmPackageFormat.GVMKIT_SQUASH)
)


Expand Down Expand Up @@ -154,7 +155,8 @@ async def run(self):
script.upload_bytes(
os.urandom(40 * 1024 * 1024), "/golem/resource/bytes.bin", progress_args=progress
)
script.download_file("/golem/resource/bytes.bin", "download.bin", progress_args=progress)
script.download_file("/golem/resource/bytes.bin",
"download.bin", progress_args=progress)
yield script

os.remove("download.bin")
Expand Down

0 comments on commit cdcf38a

Please sign in to comment.