diff --git a/marine-examples/url-downloader/.fluence/aqua/workers.aqua b/marine-examples/url-downloader/.fluence/aqua/workers.aqua index 33c4ddb..66b1a7c 100644 --- a/marine-examples/url-downloader/.fluence/aqua/workers.aqua +++ b/marine-examples/url-downloader/.fluence/aqua/workers.aqua @@ -1,10 +1,10 @@ data GetWorkersInfoDealsDefaultWorker: - timestamp: string definition: string - chainNetwork: string - chainNetworkId: u64 + timestamp: string dealIdOriginal: string dealId: string + chainNetwork: string + chainNetworkId: u64 data GetWorkersInfoDeals: defaultWorker: GetWorkersInfoDealsDefaultWorker @@ -28,4 +28,4 @@ data GetWorkersInfo: hosts: GetWorkersInfoHosts func getWorkersInfo() -> GetWorkersInfo: - <- GetWorkersInfo(deals=GetWorkersInfoDeals(defaultWorker=GetWorkersInfoDealsDefaultWorker(timestamp="2023-04-24T00:18:54.042Z",definition="bafkreifh4vhq5kqpkbhaxmb4iuzg7rr33oxjvksxmarwkekotj26u2vsju",chainNetwork="testnet",chainNetworkId=1313161555,dealIdOriginal="0x9d7503E13Bc2d3430536e3d5D635D8172141d884",dealId="9d7503e13bc2d3430536e3d5d635d8172141d884")),hosts=GetWorkersInfoHosts(defaultWorker=GetWorkersInfoHostsDefaultWorker(definition="bafkreifh4vhq5kqpkbhaxmb4iuzg7rr33oxjvksxmarwkekotj26u2vsju",installationSpells=[GetWorkersInfoHostsDefaultWorkerInstallationSpells(hostId="12D3KooWJ4bTHirdTFNZpCS72TAzwtdmavTBkkEXtzo6wHL25CtE",spellId="039f4e06-923e-4a21-8814-8164fa9b137c",workerId="12D3KooWKsxVXgnpL4wrTts9d49jiNSEN1auaxotdMYa4HpFS66g")],timestamp="2023-04-23T23:47:35.550Z",relayId="12D3KooWMigkP4jkVyufq5JnDJL6nXvyjeaDNpRfEZqQhsG3sYCU"))) + <- GetWorkersInfo(deals=GetWorkersInfoDeals(defaultWorker=GetWorkersInfoDealsDefaultWorker(definition="bafkreiavs62hqa5gax2vk6iazyy3jb7iw2xsik55373kzlbznghjhplbtq",timestamp="2023-04-24T19:12:03.894Z",dealIdOriginal="0x475F6ffb327821F77F33dD3bf6701c24172C63bB",dealId="475f6ffb327821f77f33dd3bf6701c24172c63bb",chainNetwork="testnet",chainNetworkId=1313161555)),hosts=GetWorkersInfoHosts(defaultWorker=GetWorkersInfoHostsDefaultWorker(definition="bafkreiavs62hqa5gax2vk6iazyy3jb7iw2xsik55373kzlbznghjhplbtq",installationSpells=[GetWorkersInfoHostsDefaultWorkerInstallationSpells(hostId="12D3KooWJ4bTHirdTFNZpCS72TAzwtdmavTBkkEXtzo6wHL25CtE",spellId="228360c0-0735-430a-858b-f7d761eec125",workerId="12D3KooWC5p6gScLhnit4RmDLoZAb29KHvnYpDB5J55XdukQ4ZKy")],timestamp="2023-04-24T19:13:48.337Z",relayId="12D3KooWMigkP4jkVyufq5JnDJL6nXvyjeaDNpRfEZqQhsG3sYCU"))) diff --git a/marine-examples/url-downloader/.fluence/workers.yaml b/marine-examples/url-downloader/.fluence/workers.yaml index b6b66a8..4fdc459 100644 --- a/marine-examples/url-downloader/.fluence/workers.yaml +++ b/marine-examples/url-downloader/.fluence/workers.yaml @@ -5,20 +5,20 @@ # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/workers.md version: 0 -hosts: - defaultWorker: - definition: bafkreifh4vhq5kqpkbhaxmb4iuzg7rr33oxjvksxmarwkekotj26u2vsju - installation_spells: - - host_id: 12D3KooWJ4bTHirdTFNZpCS72TAzwtdmavTBkkEXtzo6wHL25CtE - spell_id: 039f4e06-923e-4a21-8814-8164fa9b137c - worker_id: 12D3KooWKsxVXgnpL4wrTts9d49jiNSEN1auaxotdMYa4HpFS66g - timestamp: 2023-04-23T23:47:35.550Z - relayId: 12D3KooWMigkP4jkVyufq5JnDJL6nXvyjeaDNpRfEZqQhsG3sYCU deals: defaultWorker: - definition: bafkreifh4vhq5kqpkbhaxmb4iuzg7rr33oxjvksxmarwkekotj26u2vsju - timestamp: 2023-04-24T00:18:54.042Z - dealIdOriginal: "0x9d7503E13Bc2d3430536e3d5D635D8172141d884" - dealId: 9d7503e13bc2d3430536e3d5d635d8172141d884 + definition: bafkreiavs62hqa5gax2vk6iazyy3jb7iw2xsik55373kzlbznghjhplbtq + timestamp: 2023-04-24T19:12:03.894Z + dealIdOriginal: "0x475F6ffb327821F77F33dD3bf6701c24172C63bB" + dealId: 475f6ffb327821f77f33dd3bf6701c24172c63bb chainNetwork: testnet chainNetworkId: 1313161555 +hosts: + defaultWorker: + definition: bafkreiavs62hqa5gax2vk6iazyy3jb7iw2xsik55373kzlbznghjhplbtq + installation_spells: + - host_id: 12D3KooWJ4bTHirdTFNZpCS72TAzwtdmavTBkkEXtzo6wHL25CtE + spell_id: 228360c0-0735-430a-858b-f7d761eec125 + worker_id: 12D3KooWC5p6gScLhnit4RmDLoZAb29KHvnYpDB5J55XdukQ4ZKy + timestamp: 2023-04-24T19:13:48.337Z + relayId: 12D3KooWMigkP4jkVyufq5JnDJL6nXvyjeaDNpRfEZqQhsG3sYCU diff --git a/marine-examples/url-downloader/src/aqua/main.aqua b/marine-examples/url-downloader/src/aqua/main.aqua index 8f5c78c..a98bd31 100644 --- a/marine-examples/url-downloader/src/aqua/main.aqua +++ b/marine-examples/url-downloader/src/aqua/main.aqua @@ -13,7 +13,7 @@ export put_workers, get_workers, get_and_save_workers func getWorkers() -> []Record: workersInfo <- getWorkersInfo() dealId = workersInfo.deals.defaultWorker.dealId - workersOp <- resolveSubnetwork(dealId) + workersOp, err <- resolveSubnetwork(dealId) <- workersOp! func put(file_name: string, file_content: []u8) -> PutResult, string, string: @@ -23,20 +23,18 @@ func put(file_name: string, file_content: []u8) -> PutResult, string, string: res <- UrlDownloader.put(file_name, file_content) <- res, w.metadata.peer_id, w.metadata.relay_id! -func get_without_ids(file_name: string) -> [][]u8: +func get_without_ids(file_name: string) -> []u8: result: *[]u8 workers <- getWorkers() for w <- workers par: on w.metadata.peer_id via w.metadata.relay_id: res <- UrlDownloader.get(file_name) - -- if res.stderr == "": - -- result <<- res.stdout - -- else: - -- result <<- [] - result <<- res.stdout - par Peer.timeout(10000, "Finding file timed out.") - join result[workers.length - 1] - <- result + if res.stderr == "": + result <<- res.stdout + -- result <<- res.stdout + join result[workers.length - 1] + par Peer.timeout(10000, "Finding file timed out.") + <- result! func get_with_ids(file_name: string, peer_id: string, relay_id: string) -> GetResult: on peer_id via relay_id: