Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
josepablofm78 committed Dec 13, 2022
1 parent dc6a5f2 commit a71e64f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/compute/compute.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,16 @@ export class ComputeService {
}

private readWorkflowTemplate(gethLocal: boolean): any {

const workflowFile = gethLocal?'nvm-compute-template-geth-localnet.yaml':'nvm-compute-template.yaml'
const templatePath = path.join(
__dirname,
'/',
`../../argo-workflows-templates/${workflowFile}`,
)
const workflowFile = gethLocal
? 'nvm-compute-template-geth-localnet.yaml'
: 'nvm-compute-template.yaml'
const templatePath = path.join(__dirname, '/', `../../argo-workflows-templates/${workflowFile}`)
const templateContent = readFileSync(templatePath, 'utf8')

return yaml.load(templateContent)
}

async createArgoWorkflow(initData: ExecuteWorkflowDto, agreementId: string): Promise<any> {

const gethLocal = (await this.getNetworkName()) === 'geth-localnet'

const workflow = this.readWorkflowTemplate(gethLocal)
Expand All @@ -123,7 +119,11 @@ export class ComputeService {
Logger.debug(`workflow DDO ${initData.workflowDid} resolved`)

workflow.metadata.namespace = this.configService.computeConfig().argo_namespace
workflow.spec.arguments.parameters = await this.createArguments(ddo, initData.consumer, gethLocal)
workflow.spec.arguments.parameters = await this.createArguments(
ddo,
initData.consumer,
gethLocal,
)
workflow.spec.workflowMetadata.labels.serviceAgreement = agreementId

workflow.spec.entrypoint = 'compute-workflow'
Expand All @@ -143,7 +143,7 @@ export class ComputeService {
private async createArguments(
workflowDdo: DDO,
consumerAddress: string,
gethLocal: boolean
gethLocal: boolean,
): Promise<{ name: string; value: string }[]> {
const metadata = workflowDdo.findServiceByType('metadata')
const workflow = metadata.attributes.main.workflow
Expand Down

0 comments on commit a71e64f

Please sign in to comment.