Workflow Definition
# This code runs inside the Voxel Farm platform
# Import the workflow lambda api
from voxelfarm import workflow_lambda
# Also import the voxelfarm client
from voxelfarm import voxelfarmclient
# Define the workflow callback functions
def receive_data(
vf : voxelfarmclient.rest,
request : workflow_lambda.request,
host : workflow_lambda.workflow_lambda_host):
host.log('Function called, doing nothing...')
return {'success': True, 'complete': False, 'error_info': 'None'}
def stage_done(
vf : voxelfarmclient.rest,
request : workflow_lambda.request,
host : workflow_lambda.workflow_lambda_host):
host.log('Function called, doing nothing...')
return {'success': True, 'complete': False, 'error_info': 'None'}
# The workflow hierarchy is defined as JSON structure
workflow = {
'name' : 'Ore Body Model',
'icon' : 'root',
'id' : 'OBDP',
'tracks' : [
{
'name' : 'Block Models',
'icon' : 'voxbm',
'id' : 'GM',
'on_receive_data' : receive_data,
'on_stage_done' : stage_done
},
{
'name' : 'Drill Holes',
'icon' : 'voxdh',
'id' : 'DH',
'tracks' : [
{
'name' : 'Blast Holes',
'icon' : 'voxdh',
'id' : 'DH_BLASTHOLES',
'on_receive_data' : receive_data,
'on_stage_done' : stage_done
},
{
'name' : 'Hardness',
'icon' : 'voxdh',
'id' : 'DH_HARDNESS',
'on_receive_data' : receive_data,
'on_stage_done' : stage_done
},
{
'name' : 'Ore Quality',
'icon' : 'voxdh',
'id' : 'DH_ORE_QUALITY',
'on_receive_data' : receive_data,
'on_stage_done' : stage_done
},
{
'name' : 'Sondajes',
'icon' : 'voxdh',
'id' : 'DH_SONDAJES',
'on_receive_data' : receive_data,
'on_stage_done' : stage_done
}
]
},
{
'name' : 'Surveys',
'icon' : 'voxsurf',
'id' : 'SURF',
'on_receive_data' : receive_data,
'on_stage_done' : stage_done
}
]
}
# Obtain the workflow_api interface
workflow_api = workflow_lambda.workflow_lambda_host()
# Set the workflow definition
workflow_api.set_workflow_definition(workflow)