diff --git a/data-computer/v1/lda.ini b/data-computer/v1/lda.ini new file mode 100644 index 0000000..4ff5b2c --- /dev/null +++ b/data-computer/v1/lda.ini @@ -0,0 +1,73 @@ +[use] +plugin = basics +plugin = analytics + +# Step 0 (générique) : Lire le fichier standard tar.gz +[TARExtract] +compress = true + +# Step 1 (générique) : Créer un identifiant unique pour le corpus reçu +[singleton] +[singleton/identify] +[singleton/env] +path = generator +value = tree-segment +path = identifier +value = get('uri').replace('uid:/', '') + +# Step 2 (générique): Traiter de manière asynchnore les items reçus +[fork] +standalone = true + +# Step 2.1 (générique): Lancer un calcul sur tous les items reçus +[fork/[exec] +# command should be executable ! +command = ./v1/lda.py + +# Step 2.2 (générique): Création d'un fichier résulat standard +[fork/TARDump] +compress = true +manifest = fix({version: '1'}) +manifest = fix({identifier: env('identifier')}) +manifest = fix({generator: env('generator')}) + +# Step 2.3 (générique): Sauvegarder sur disque le résulat +[fork/FILESave] +location = /tmp/retrieve +identifier = env('identifier') +jsonl = false +compress = false + +# Step 2.4 (générique): Signaler le fin du traitement via un appel à un webhook (si il a été précisé) +[fork/swing] +test = env('headers.x-hook').startsWith('http') + +# Step 2.4.1 (générique): Séléctionner les informations à envoyer au webhook +[fork/swing/replace] +path = body +value = self().pick(['size', 'atime', 'mtime', 'ctime']).set('identifier', env('identifier')).set('generator', env('generator')).set('state', 'ready') + +# Step 2.4.2 (générique): Envoyer la requète HTTP +[fork/swing/URLFetch] +url = env('headers.x-hook') +path = body +headers = Content-Type:application/json + +# Step 2.4.3 (faculatif) : Ajouter une trace dans log +[fork/swing/debug] +text = webhook triggered + +# Step 2.5 (faculatif) : Ajouter une trace dans log +[fork/debug] +text = process completed + +# Step 3 : Renvoyer immédiatement seul élément indiquant comment récupérer le résulat quand il sera prêt +[shift] +[replace] +path = id +value = env('generator') +path = value +value = env('identifier') + +[JSONString] +indent = env('indent') diff --git a/data-computer/v1/lda.py b/data-computer/v1/lda.py new file mode 100755 index 0000000..3728339 --- /dev/null +++ b/data-computer/v1/lda.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +import json +import sys + +for line in sys.stdin: + data=json.loads(line) + data['lda']='Comming soon' + sys.stdout.write(json.dumps(data)) + sys.stdout.write('\n') + diff --git a/data-computer/v1/tree-segment.ini b/data-computer/v1/tree-segment.ini index b797dc0..8539cc4 100644 --- a/data-computer/v1/tree-segment.ini +++ b/data-computer/v1/tree-segment.ini @@ -68,7 +68,7 @@ [fork/swing] test = env('headers.x-hook').startsWith('http') -# Step 2.4.1 (générique): Séléctionner les informations à envoyer au webhook +# Step 2.4.1 (générique): Séléctionner les informations à envoyer au webhook [fork/swing/replace] path = body value = self().pick(['size', 'atime', 'mtime', 'ctime']).set('identifier', env('identifier')).set('generator', env('generator')).set('state', 'ready') @@ -96,4 +96,4 @@ value = env('identifier') [JSONString] -indent = env('indent') \ No newline at end of file +indent = env('indent')