Closed AlexFihman closed 1 year ago
hello @AlexFihman your worker function is not a script generator -> the worker must yield at least one script that will be executed by the engine
once you modify it to read (notice the yield
statement after the script is constructed and before the results are awaited):
async def worker(context: WorkContext, tasks: AsyncIterable[Task]):
async for task in tasks:
provider_id = provider_ids[context.provider_name]
print(f'provider_name: {context.provider_name}')
print(f'provider_id: {provider_id}')
tested_providers.append(provider_ids[context.provider_name])
os.system(f"date >> start.txt")
os.system(f"echo {provider_id} >> start.txt")
script = context.new_script()
script.run("/bin/sh", "-c", f"printf \"{provider_id}\n\" >> geek.txt")
script.run("/bin/sh", "-c", "sysbench --test=cpu --cpu-max-prime=10000 run | grep \"events per second\" >> geek.txt")
script.run("/bin/sh", "-c", "sysbench --test=cpu --cpu-max-prime=10000 --threads=`nproc` run | grep \"events per second\" >> geek.txt")
# context.run("/bin/sh", "-c", "7z b >> geek.txt")
script.run("/bin/sh", "-c", "ls -la /golem/work/")
output_file = "geek2.txt"
script.run("/bin/sh", "-c", "mv /golem/work/*.* /golem/output")
future_results = script.download_file("/golem/output/geek.txt", output_file)
yield script
results = await future_results
os.system(f"cat {output_file} >> geek.txt")
os.system(f"date >> finish.txt")
os.system(f"echo {provider_id} >> finish.txt")
it should work as intended
Description
OS: Ubuntu 22.04.2 LTS
yagna daemon version: yagna 0.12.2 (8efd8657 2023-06-06 build #296) [ can be determined with
yagna --version
]Python version: Python 3.10.6 [ can be determined with
python --version
]yapapi library version: 0.11.0 [ can be determined using:
python -c "import yapapi; print(yapapi.__version__)"
]yapapi branch: [ if you're using one of our included examples ]
Description of the issue: Running task on golem engine fails with error message: [2023-07-24T10:09:59.068+0000 WARNING yapapi.summary] [Job 1] Worker for provider 'etam.h' failed; reason: 'coroutine' object has no attribute 'anext'
Actual result: task works, as with python 3.8
Screenshots: If applicable, add screenshots to help explain your problem.
Steps To Reproduce
start yagna on test env. run attached script
Expected behavior
should run
Logs and any additional context
hello.zip