Skip to content

Commit

Permalink
introduce entrypoint to get the status of async process
Browse files Browse the repository at this point in the history
  • Loading branch information
touv committed Dec 20, 2024
1 parent fa71402 commit 5d3ab2c
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 19 deletions.
11 changes: 11 additions & 0 deletions services/data-computer/examples.http
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ Content-Type: application/json
}
]

###
# @name v1RetrieveStatus
POST {{host}}/v1/retrieve-status HTTP/1.1
Content-Type: application/json

[
{
"value":"36ji5xEk9"
}
]

###
# @name v1RetrieveJSON
POST {{host}}/v1/retrieve-json?indent=true HTTP/1.1
Expand Down
5 changes: 3 additions & 2 deletions services/data-computer/v1/buffer-pdf.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ content = get('value')
identifier = get('id')
location = /tmp/upload

[debug]
text = fix('Data received by', env('generator'), 'for', env('identifier')).join(' ')
[combine]
primer = PDF received
file = timestamp.cfg

[exchange]
value = get('filename')
Expand Down
5 changes: 3 additions & 2 deletions services/data-computer/v1/buffer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ identifier = env('identifier')
location = /tmp/upload
compress = true

[debug]
text = fix('Data received by', env('generator'), 'for', env('identifier')).join(' ')
[combine]
primer = Data received
file = timestamp.cfg

[exchange]
value = get('filename')
Expand Down
5 changes: 5 additions & 0 deletions services/data-computer/v1/charger.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@ value = self().omit([env('pid')])

[metrics]
bucket = charger

[combine]
primer = Data charged
file = timestamp.cfg

10 changes: 6 additions & 4 deletions services/data-computer/v1/logger.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ bucket = logger
# On ne garde que la première erreur déclénchée
[shift]

[debug]
text = Error trapped
[combine]
primer = Error trapped
file = timestamp.cfg

[assign]
path = body.identifier
Expand Down Expand Up @@ -51,5 +52,6 @@ identifier = env('identifier')
jsonl = true
compress = false

[debug]
text = Error was saved
[combine]
primer = Error was saved
file = timestamp.cfg
21 changes: 12 additions & 9 deletions services/data-computer/v1/recorder.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
plugin = basics
plugin = analytics

[singleton]
[singleton/debug]
text = fix('One first result received by', env('generator'), 'for', env('identifier')).join(' ')
[combine]
primer = One first result received
file = timestamp.cfg

[metrics]
bucket = recorder
Expand Down Expand Up @@ -34,8 +34,9 @@ value = env('headers.x-webhook-success')
path = body
value = self().pick(['size', 'atime', 'mtime', 'ctime']).set('identifier', env('identifier')).set('generator', env('generator')).set('state', 'ready')

[swing/debug]
text = fix('Result generated by', env('generator'), 'for', env('identifier')).join(' ')
[swing/combine]
primer = Result generated
file = timestamp.cfg

# Step 2.4.2 (générique): Envoyer la requète HTTP
[swing/URLFetch]
Expand All @@ -46,11 +47,13 @@ retries = 5
timeout = 30000

# Step 2.4.3 (faculatif) : Ajouter une trace dans log
[swing/debug]
text = fix('WebHook triggered by', env('generator'), 'for', env('identifier')).join(' ')
[swing/combine]
primer = WebHook triggered
file = timestamp.cfg

# Step 2.5 (faculatif) : Ajouter une trace dans log
[debug]
text = fix('Process completed by', env('generator'), 'for', env('identifier')).join(' ')
[swing/combine]
primer = Process completed
file = timestamp.cfg


27 changes: 27 additions & 0 deletions services/data-computer/v1/retrieve-status.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Entrypoint output format
mimeType = application/jsonl
extension = jsonl

# OpenAPI Documentation - JSON format (dot notation)
post.operationId = post-v1-retrieve
post.summary = Récupération du status d'un traitement
post.description = Les traitements étant asynchrones le status du traitement peut-être récupér par cette route
post.tags.0 = data-computer
post.responses.default.description = Fichier corpus au format jsonl
post.responses.default.content.application/jsonl.schema.type = string
post.requestBody.content.application/json.example.0.value = xMkWJX7GU
post.requestBody.content.application/json.schema.$ref = #/components/schemas/JSONStream
post.requestBody.required = true
[use]
plugin = basics
[JSONParse]
separator = *
[exchange]
value = get('value')
[FILELoad]
location = /tmp/logs
2 changes: 0 additions & 2 deletions services/data-computer/v1/statistics.ini
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ file = buffer.cfg
path = value

# Step 2.1.2 (spécifique): Créer des tableaux de paires des segments (ou Bigramme)
[fork/delegate/debug]

[fork/delegate/assign]
path = _statistics.value.input
value = get('value')
Expand Down
23 changes: 23 additions & 0 deletions services/data-computer/v1/timestamp.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[debug]
text = timestamp

[fork]
standalone = true
logger = logger.cfg

[fork/replace]
path = timestamp
value = fix(Date.now())
path = generator
value = env('generator')
path = identifier
value = env('identifier')
path = message
value = self()

[fork/FILESave]
location = /tmp/logs
identifier = env('identifier')
jsonl = true
compress = false
append = true

0 comments on commit 5d3ab2c

Please sign in to comment.