Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added services/data-graph/test-empty-abstract.tar.gz
Binary file not shown.
63 changes: 63 additions & 0 deletions services/data-graph/tests.hurl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
# DON'T OVERWRITE IT
# Use it to test:
# npx hurl --test data-computer/tests.hurl
Comment on lines 3 to 4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

polish: ‏Remove duplicate part

Suggested change
# Use it to test:
# npx hurl --test data-computer/tests.hurl

# Use it to test:
# HURL_blocked=false npx hurl --test --variable host="http://localhost:31976" tests.hurl
# or (from root of the repo)
# HURL_blocked=false npm run test:local data-graph


POST {{host}}/v1/graph
content-type: application/x-tar
Expand Down Expand Up @@ -107,3 +112,61 @@ jsonpath "$[*].value['viz$size'].value" exists
jsonpath "$[*].value['viz$position'].x" exists
jsonpath "$[*].value['viz$position'].y" exists
jsonpath "$[*].value['viz$position'].z" exists


# ------------------------------
POST {{host}}/v1/teeft-graph
content-type: application/x-tar
x-hook: https://webhook.site/69300b22-a251-4c16-9905-f7ba218ae7e9
[Options]
skip: {{blocked}}
file,test-empty-abstract.tar.gz;

HTTP 200
# Capture the computing token
[Captures]
computing_token: jsonpath "$[0].value"
[Asserts]
variable "computing_token" exists

POST {{host}}/v1/retrieve-json
content-type: application/json
[Options]
delay: 40000
skip: {{blocked}}
```
[
{
"value":"{{computing_token}}"
}
]
```

HTTP 200
Content-Type: application/json
[Asserts]

jsonpath "$" count > 0

jsonpath "$[*].id" exists

jsonpath "$[*].value" exists
jsonpath "$[*].value.label" exists

jsonpath "$[*].attributes.weight" exists
jsonpath "$[*].attributes.subset" exists

jsonpath "$[0].value.targets[0].id" exists
jsonpath "$[0].value.targets[1].id" exists
jsonpath "$[0].value.targets[1].thickness" exists

jsonpath "$[*].value['viz$color'].r" exists
jsonpath "$[*].value['viz$color'].g" exists
jsonpath "$[*].value['viz$color'].b" exists
jsonpath "$[*].value['viz$color'].a" exists

jsonpath "$[*].value['viz$size'].value" exists

jsonpath "$[*].value['viz$position'].x" exists
jsonpath "$[*].value['viz$position'].y" exists
jsonpath "$[*].value['viz$position'].z" exists
14 changes: 12 additions & 2 deletions services/data-graph/v1/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,22 @@

# load all datas
lines = []
pid = ""
for line in sys.stdin:
data = json.loads(line)
if not len(lines):
pid = data[[x for x in list(data.keys()) if x.startswith("PID")][0]][5:]
print("Received data: ", data, file=sys.stderr)
if pid == "":
keys = data.keys()
for k in keys:
if k.startswith("PID"):
pid = data[k][5:]
break
lines.append(data["value"])


# if pid == "" and data["value"] != []:
# pid = data[[x for x in list(data.keys()) if x.startswith("PID")][0]][5:]

Comment on lines +27 to +30
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

polish: ‏Dead code

We should remove unused code

Suggested change
# if pid == "" and data["value"] != []:
# pid = data[[x for x in list(data.keys()) if x.startswith("PID")][0]][5:]

print("PID ",pid, file=sys.stderr)
print(time.strftime("%A %d %B %Y %H:%M:%S"), file=sys.stderr)
keyword = []
Expand Down
2 changes: 1 addition & 1 deletion services/data-graph/v1/retrieve-gexf-and-img.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extension = tar.gz
post.operationId = post-v1-retrieve-gexf&img
post.summary = Récupération du résultat sous format xml/gexf et png, dans un tar.gz. Pour utiliser le fichier gexf, assurez-vous de changer l'extension en `.gexf`.
post.description = Récupération du résultat sous format xml/gexf et png, dans un tar.gz. Pour utiliser le fichier gexf, assurez-vous de changer l'extension en `.gexf`.
post.tags.0 = data-graph
post.tags.0 = retrieves
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 praise: ‏Good idea

post.responses.default.description = Fichier corpus au format tar.gz
post.responses.default.content.application/x-gzip.schema.type = string
post.responses.default.content.application/x-gzip.schema.format = binary
Expand Down
2 changes: 1 addition & 1 deletion services/data-graph/v1/retrieve-gexf.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extension = gexf
post.operationId = post-v1-retrieve-gexf
post.summary = Récupération d'un résultat produit sous forme d'un XML / GEXF
post.description = Les traitements étant asynchrones le résultat, une fois créé, doit être récupéré par cette route. Pour l'utiliser, assurez-vous de changer l'extension en `.gexf`
post.tags.0 = data-graph
post.tags.0 = retrieves
post.responses.default.description = Fichier graphe au format GEXF
post.requestBody.required = true

Expand Down
2 changes: 1 addition & 1 deletion services/data-graph/v1/retrieve-img.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mimeType = image/png
post.operationId = post-v1-retrieve-img
post.description = Récupération d'un résultat produit sous forme d'un fichier image
post.summary = Récupération d'un résultat produit sous forme d'un fichier image
post.tags.0 = data-graph
post.tags.0 = retrieves
post.responses.default.description = Fichier image au format PNG
post.requestBody.content.application/json.example.0.value = xMkWJX7GU
post.requestBody.content.application/json.schema.$ref = #/components/schemas/JSONStream
Expand Down
2 changes: 1 addition & 1 deletion services/data-graph/v1/retrieve-json.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ post.operationId = post-v1-retrieve-json
post.summary = Récupération d'un résultat produit sous forme d'un JSON GEXF
post.description = Renvoie la version au format JSON d'un fichier GEXF produit par un traitement asynchrone.
#'
post.tags.0 = data-graph
post.tags.0 = retrieves
post.responses.default.description = Fichier graphe GEXF au format JSON
post.requestBody.required = true

Expand Down
2 changes: 1 addition & 1 deletion services/data-graph/v1/retrieve-status.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extension = jsonl
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-graph
post.tags.0 = retrieves
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
Expand Down
2 changes: 1 addition & 1 deletion services/data-graph/v1/retrieve.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extension = tar.gz
post.operationId = post-v1-retrieve
post.summary = Récupération d'un résultat produit sous forme d'un fichier corpus
post.description = Les traitements étant asynchrones le résultat une fois créé doit être récupéré par cette route
post.tags.0 = data-graph
post.tags.0 = retrieves
post.responses.default.description = Fichier corpus au format tar.gz
post.responses.default.content.application/x-gzip.schema.type = string
post.responses.default.content.application/x-gzip.schema.format = binary
Expand Down