Skip to content

Commit

Permalink
[WIP] Add Swag/OpenAPI deps (#1214)
Browse files Browse the repository at this point in the history
  • Loading branch information
enricorotundo authored Nov 18, 2022
1 parent 33be34c commit 2823057
Show file tree
Hide file tree
Showing 29 changed files with 5,006 additions and 82 deletions.
1,419 changes: 1,419 additions & 0 deletions docs/docs.go

Large diffs are not rendered by default.

1,398 changes: 1,398 additions & 0 deletions docs/swagger.json

Large diffs are not rendered by default.

1,431 changes: 1,431 additions & 0 deletions docs/swagger.yaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/swagger/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This folder contains markdown files to use as descriptions in OpenAPI/Swagger annotations.
109 changes: 109 additions & 0 deletions docs/swagger/endpoints_events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
Events (e.g. Created, Bid, BidAccepted, ..., ResultsAccepted, ResultsPublished) are useful to track the progress of a job.

Example response (truncated):
```json
{
"events": [
{
"APIVersion": "V1beta1",
"JobID": "9304c616-291f-41ad-b862-54e133c0149e",
"ClientID": "ac13188e93c97a9c2e7cf8e86c7313156a73436036f30da1ececc2ce79f9ea51",
"SourceNodeID": "QmXaXu9N5GNetatsvwnTfQqNtSeKAD6uCmarbh3LMRYAcF",
"EventName": "Created",
"Spec": {
"Engine": "Docker",
"Verifier": "Noop",
"Publisher": "Estuary",
"Docker": {
"Image": "ubuntu",
"Entrypoint": [
"date"
]
},
"Language": {
"JobContext": {}
},
"Wasm": {},
"Resources": {
"GPU": ""
},
"Timeout": 1800,
"outputs": [
{
"StorageSource": "IPFS",
"Name": "outputs",
"path": "/outputs"
}
],
"Sharding": {
"BatchSize": 1,
"GlobPatternBasePath": "/inputs"
}
},
"JobExecutionPlan": {
"ShardsTotal": 1
},
"Deal": {
"Concurrency": 1
},
"VerificationResult": {},
"PublishedResult": {},
"EventTime": "2022-11-17T13:32:55.331375351Z",
"SenderPublicKey": "..."
},
...
{
"JobID": "9304c616-291f-41ad-b862-54e133c0149e",
"SourceNodeID": "QmXaXu9N5GNetatsvwnTfQqNtSeKAD6uCmarbh3LMRYAcF",
"TargetNodeID": "QmdZQ7ZbhnvWY1J12XYKGHApJ6aufKyLNSvf8jZBrBaAVL",
"EventName": "ResultsAccepted",
"Spec": {
"Docker": {},
"Language": {
"JobContext": {}
},
"Wasm": {},
"Resources": {
"GPU": ""
},
"Sharding": {}
},
"JobExecutionPlan": {},
"Deal": {},
"VerificationResult": {
"Complete": true,
"Result": true
},
"PublishedResult": {},
"EventTime": "2022-11-17T13:32:55.707825569Z",
"SenderPublicKey": "..."
},
{
"JobID": "9304c616-291f-41ad-b862-54e133c0149e",
"SourceNodeID": "QmdZQ7ZbhnvWY1J12XYKGHApJ6aufKyLNSvf8jZBrBaAVL",
"EventName": "ResultsPublished",
"Spec": {
"Docker": {},
"Language": {
"JobContext": {}
},
"Wasm": {},
"Resources": {
"GPU": ""
},
"Sharding": {}
},
"JobExecutionPlan": {},
"Deal": {},
"VerificationResult": {},
"PublishedResult": {
"StorageSource": "IPFS",
"Name": "job-9304c616-291f-41ad-b862-54e133c0149e-shard-0-host-QmdZQ7ZbhnvWY1J12XYKGHApJ6aufKyLNSvf8jZBrBaAVL",
"CID": "QmTVmC7JBD2ES2qGPqBNVWnX1KeEPNrPGb7rJ8cpFgtefe"
},
"EventTime": "2022-11-17T13:32:55.756658941Z",
"SenderPublicKey": "..."
}
]
}
```
191 changes: 191 additions & 0 deletions docs/swagger/endpoints_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
Returns the first (sorted) #`max_jobs` jobs that belong to the `client_id` passed in the body payload (by default).
If `return_all` is set to true, it returns all jobs on the Bacalhau network.

If `id` is set, it returns only the job with that ID.

Example response:
```json
{
"jobs": [
{
"APIVersion": "V1beta1",
"ID": "9304c616-291f-41ad-b862-54e133c0149e",
"RequesterNodeID": "QmXaXu9N5GNetatsvwnTfQqNtSeKAD6uCmarbh3LMRYAcF",
"RequesterPublicKey": "...",
"ClientID": "ac13188e93c97a9c2e7cf8e86c7313156a73436036f30da1ececc2ce79f9ea51",
"Spec": {
"Engine": "Docker",
"Verifier": "Noop",
"Publisher": "Estuary",
"Docker": {
"Image": "ubuntu",
"Entrypoint": [
"date"
]
},
"Language": {
"JobContext": {}
},
"Wasm": {},
"Resources": {
"GPU": ""
},
"Timeout": 1800,
"outputs": [
{
"StorageSource": "IPFS",
"Name": "outputs",
"path": "/outputs"
}
],
"Sharding": {
"BatchSize": 1,
"GlobPatternBasePath": "/inputs"
}
},
"Deal": {
"Concurrency": 1
},
"ExecutionPlan": {
"ShardsTotal": 1
},
"CreatedAt": "2022-11-17T13:32:55.33837275Z",
"JobState": {
"Nodes": {
"QmSyJ8VUd4YSPwZFJSJsHmmmmg7sd4BAc2yHY73nisJo86": {
"Shards": {
"0": {
"NodeId": "QmSyJ8VUd4YSPwZFJSJsHmmmmg7sd4BAc2yHY73nisJo86",
"State": "Cancelled",
"VerificationResult": {},
"PublishedResults": {}
}
}
},
"QmYgxZiySj3MRkwLSL4X2MF5F9f2PMhAE3LV49XkfNL1o3": {
"Shards": {
"0": {
"NodeId": "QmYgxZiySj3MRkwLSL4X2MF5F9f2PMhAE3LV49XkfNL1o3",
"State": "Cancelled",
"VerificationResult": {},
"PublishedResults": {}
}
}
},
"QmdZQ7ZbhnvWY1J12XYKGHApJ6aufKyLNSvf8jZBrBaAVL": {
"Shards": {
"0": {
"NodeId": "QmdZQ7ZbhnvWY1J12XYKGHApJ6aufKyLNSvf8jZBrBaAVL",
"State": "Completed",
"Status": "Got results proposal of length: 0",
"VerificationResult": {
"Complete": true,
"Result": true
},
"PublishedResults": {
"StorageSource": "IPFS",
"Name": "job-9304c616-291f-41ad-b862-54e133c0149e-shard-0-host-QmdZQ7ZbhnvWY1J12XYKGHApJ6aufKyLNSvf8jZBrBaAVL",
"CID": "QmTVmC7JBD2ES2qGPqBNVWnX1KeEPNrPGb7rJ8cpFgtefe"
},
"RunOutput": {
"stdout": "Thu Nov 17 13:32:55 UTC 2022\n",
"stdouttruncated": false,
"stderr": "",
"stderrtruncated": false,
"exitCode": 0,
"runnerError": ""
}
}
}
}
}
}
},
{
"APIVersion": "V1beta1",
"ID": "92d5d4ee-3765-4f78-8353-623f5f26df08",
"RequesterNodeID": "QmXaXu9N5GNetatsvwnTfQqNtSeKAD6uCmarbh3LMRYAcF",
"RequesterPublicKey": "...",
"ClientID": "ac13188e93c97a9c2e7cf8e86c7313156a73436036f30da1ececc2ce79f9ea51",
"Spec": {
"Engine": "Docker",
"Verifier": "Noop",
"Publisher": "Estuary",
"Docker": {
"Image": "ubuntu",
"Entrypoint": [
"sleep",
"4"
]
},
"Language": {
"JobContext": {}
},
"Wasm": {},
"Resources": {
"GPU": ""
},
"Timeout": 1800,
"outputs": [
{
"StorageSource": "IPFS",
"Name": "outputs",
"path": "/outputs"
}
],
"Sharding": {
"BatchSize": 1,
"GlobPatternBasePath": "/inputs"
}
},
"Deal": {
"Concurrency": 1
},
"ExecutionPlan": {
"ShardsTotal": 1
},
"CreatedAt": "2022-11-17T13:29:01.871140291Z",
"JobState": {
"Nodes": {
"QmSyJ8VUd4YSPwZFJSJsHmmmmg7sd4BAc2yHY73nisJo86": {
"Shards": {
"0": {
"NodeId": "QmSyJ8VUd4YSPwZFJSJsHmmmmg7sd4BAc2yHY73nisJo86",
"State": "Cancelled",
"VerificationResult": {},
"PublishedResults": {}
}
}
},
"QmYgxZiySj3MRkwLSL4X2MF5F9f2PMhAE3LV49XkfNL1o3": {
"Shards": {
"0": {
"NodeId": "QmYgxZiySj3MRkwLSL4X2MF5F9f2PMhAE3LV49XkfNL1o3",
"State": "Completed",
"Status": "Got results proposal of length: 0",
"VerificationResult": {
"Complete": true,
"Result": true
},
"PublishedResults": {
"StorageSource": "IPFS",
"Name": "job-92d5d4ee-3765-4f78-8353-623f5f26df08-shard-0-host-QmYgxZiySj3MRkwLSL4X2MF5F9f2PMhAE3LV49XkfNL1o3",
"CID": "QmWUXBndMuq2G6B6ndQCmkRHjZ6CvyJ8qLxXBG3YsSFzQG"
},
"RunOutput": {
"stdout": "",
"stdouttruncated": false,
"stderr": "",
"stderrtruncated": false,
"exitCode": 0,
"runnerError": ""
}
}
}
}
}
}
}
]
}
```
14 changes: 14 additions & 0 deletions docs/swagger/endpoints_peers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
As described in the [architecture docs](https://docs.bacalhau.org/about-bacalhau/architecture), each node is connected to a number of peer nodes.

Example response:
```json
{
"bacalhau-job-event": [
"QmdZQ7ZbhnvWY1J12XYKGHApJ6aufKyLNSvf8jZBrBaAVL",
"QmXaXu9N5GNetatsvwnTfQqNtSeKAD6uCmarbh3LMRYAcF",
"QmVAb7r2pKWCuyLpYWoZr9syhhFnTWeFaByHdb8PkkhLQG",
"QmUDAXvv31WPZ8U9CzuRTMn9iFGiopGE7rHiah1X8a6PkT",
"QmSyJ8VUd4YSPwZFJSJsHmmmmg7sd4BAc2yHY73nisJo86"
]
}
```
16 changes: 16 additions & 0 deletions docs/swagger/endpoints_results.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Example response:

```json
{
"results": [
{
"NodeID": "QmdZQ7ZbhnvWY1J12XYKGHApJ6aufKyLNSvf8jZBrBaAVL",
"Data": {
"StorageSource": "IPFS",
"Name": "job-9304c616-291f-41ad-b862-54e133c0149e-shard-0-host-QmdZQ7ZbhnvWY1J12XYKGHApJ6aufKyLNSvf8jZBrBaAVL",
"CID": "QmTVmC7JBD2ES2qGPqBNVWnX1KeEPNrPGb7rJ8cpFgtefe"
}
}
]
}
```
56 changes: 56 additions & 0 deletions docs/swagger/endpoints_states.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
Example response:

```json
{
"state": {
"Nodes": {
"QmSyJ8VUd4YSPwZFJSJsHmmmmg7sd4BAc2yHY73nisJo86": {
"Shards": {
"0": {
"NodeId": "QmSyJ8VUd4YSPwZFJSJsHmmmmg7sd4BAc2yHY73nisJo86",
"State": "Cancelled",
"VerificationResult": {},
"PublishedResults": {}
}
}
},
"QmYgxZiySj3MRkwLSL4X2MF5F9f2PMhAE3LV49XkfNL1o3": {
"Shards": {
"0": {
"NodeId": "QmYgxZiySj3MRkwLSL4X2MF5F9f2PMhAE3LV49XkfNL1o3",
"State": "Cancelled",
"VerificationResult": {},
"PublishedResults": {}
}
}
},
"QmdZQ7ZbhnvWY1J12XYKGHApJ6aufKyLNSvf8jZBrBaAVL": {
"Shards": {
"0": {
"NodeId": "QmdZQ7ZbhnvWY1J12XYKGHApJ6aufKyLNSvf8jZBrBaAVL",
"State": "Completed",
"Status": "Got results proposal of length: 0",
"VerificationResult": {
"Complete": true,
"Result": true
},
"PublishedResults": {
"StorageSource": "IPFS",
"Name": "job-9304c616-291f-41ad-b862-54e133c0149e-shard-0-host-QmdZQ7ZbhnvWY1J12XYKGHApJ6aufKyLNSvf8jZBrBaAVL",
"CID": "QmTVmC7JBD2ES2qGPqBNVWnX1KeEPNrPGb7rJ8cpFgtefe"
},
"RunOutput": {
"stdout": "Thu Nov 17 13:32:55 UTC 2022\n",
"stdouttruncated": false,
"stderr": "",
"stderrtruncated": false,
"exitCode": 0,
"runnerError": ""
}
}
}
}
}
}
}
```
Loading

0 comments on commit 2823057

Please sign in to comment.