nl_tokens: Creates k8s Service and Job for the Teraslice Execution Controller ( formerly slicer ) . This currently works by creating a service with a hostname that contains the exId in it listening on a well known port . The hostname and port are used later by the workers to contact this Execution Controller .
pl_tokens: function allocateSlicer ( execution ) { const exSvcResource = new K8sResource ( 'services' , 'execution_controller' , context . sysconfig . teraslice , execution ) ; const exService = exSvcResource . resource ; execution . slicer_port = _ . get ( exService , 'spec.ports[0].targetPort' ) ; execution . slicer_hostname = _ . get ( exService , 'metadata.name' ) ; const exJobResource = new K8sResource ( 'jobs' , 'execution_controller' , context . sysconfig . teraslice , execution ) ; const exJob = exJobResource . resource ; logger . debug ( ` \n \n ${ JSON . stringify ( exJob , null , 2 ) } ` ) ; // TODO: This should try slicerAllocationAttempts times?? return k8s . post ( exService , 'service' ) . then ( result => logger . debug ( ` ${ JSON . stringify ( result ) } ` ) ) . catch ( ( err ) => { const error = new TSError ( err , { reason : 'Error submitting k8s slicer service' } ) ; return Promise . reject ( error ) ; } ) . then ( ( ) => k8s . post ( exJob , 'job' ) ) . then ( result => logger . <mask> ( ` ${ JSON . stringify ( result ) } ` ) ) . catch ( ( err ) => { const error = new TSError ( err , { reason : 'Error submitting k8s slicer job' } ) ; return Promise . reject ( error ) ; } ) ; }