-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
We should address in further tasks for vscode-extension to not hardcode the docker image and tags because ocean-node will configure volumes based on branin docker image (which happens right now), but running a different algorithm code:
algorithm: {
meta: {
rawcode: 'import time\n' +
'import asyncio\n' +
'import os\n' +
'\n' +
'# Constants for timing (in seconds)\n' +
'TOTAL_DURATION = 10 # 10 seconds\n' +
'LOG_INTERVAL = 1 # 1 second\n' +
'\n' +
'async def run_logging():\n' +
" print('RAW CODE: Starting logging process...')\n" +
' \n' +
' start_time = time.time()\n' +
' current_iteration = 1\n' +
' results = []\n' +
' \n' +
' while True:\n' +
' elapsed_time = time.time() - start_time\n' +
' \n' +
" log_entry = f'Log iteration {current_iteration}: {elapsed_time:.3f} seconds elapsed'\n" +
' print(log_entry)\n' +
' results.append(log_entry)\n' +
' current_iteration += 1\n' +
' \n' +
' if elapsed_time >= TOTAL_DURATION:\n' +
" print('Completed')\n" +
' \n' +
" # Create the output directory if it doesn't exist\n" +
" output_dir = '/data/outputs'\n" +
' os.makedirs(output_dir, exist_ok=True)\n' +
' \n' +
' # Save results to a text file\n' +
" txt_file = f'{output_dir}/results.txt'\n" +
' \n' +
" with open(txt_file, 'w') as f:\n" +
" f.write(f'PY Algorithm Results\\n')\n" +
" f.write(f'Total time: {elapsed_time:.3f} seconds\\n')\n" +
" f.write(f'Total iterations: {current_iteration - 1}\\n')\n" +
' \n' +
' print(f"Results saved as {txt_file}")\n' +
" return 'completed'\n" +
' \n' +
' await asyncio.sleep(LOG_INTERVAL)\n' +
'\n' +
'if __name__ == "__main__":\n' +
' asyncio.run(run_logging())',
container: [Object]
}
},
assets: [],
isRunning: true,
isStarted: false,
**containerImage: 'oceanprotocol/algo_dockers:python-branin'**,
Metadata
Metadata
Assignees
Labels
No labels