Newer
Older
web-services / data-computer / v1 / tree-segment.ini
@Nicolas Thouvenin Nicolas Thouvenin on 8 Sep 3 KB add graph-segment
# Entrypoint output format
mimeType = application/json

# OpenAPI Documentation - JSON format (dot notation)
post.operationId = post-v1-lda
post.description = Création de segments à partir de tableaux
post.summary = Le corpus est transformé en liste de segment (source, target, weight) à partir d'un tableau simple ou d'un tableau imbriqué
post.tags.0 = data-computer
post.requestBody.content.application/x-tar.schema.type = string
post.requestBody.content.application/x-tar.schema.format = binary
post.requestBody.required = true
post.responses.default.description = Informations permettant de récupérer les données le moment venu
post.parameters.0.description = Indenter le JSON résultant
post.parameters.0.in = query
post.parameters.0.name = indent
post.parameters.0.schema.type = boolean

[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/delegate]

# Step 2.1.1 (spécifique): S'assurer d'avoir des tableaux de tableaux
[fork/delegate/replace]
path = id
value = get('id')
path = value
value = get('value').thru(x => x && Array.isArray(x[0])?x:[x])

# Step 2.1.2 (spécifique): Créer des tableaux de paires des segments (ou Bigramme)
[fork/delegate/segment]
aggregate = false
path = value
identifier = id

# Step 2.1.3 (spécifique): Regrouper les segments
[fork/delegate/aggregate]

# Step 2.1.4 (spécifique): Construire un résulat spécifique du calcul
[fork/delegate/replace]
path = source
value = get('id.0')
path = target
value = get('id.1')
path = weight
value = get('value').size()
path = origin
value = get('value').uniq()

# 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')