Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug C2d connection (towards #606) #610

Merged
merged 90 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
a9598fc
Increased no retries and backoff factor.
mariacarmina Mar 3, 2023
db65c9c
updated workflow.
mariacarmina Mar 3, 2023
613cb0c
tweak.
mariacarmina Mar 3, 2023
c40e9a0
tweak 2.
mariacarmina Mar 3, 2023
7e9ad42
updated workflow 2.
mariacarmina Mar 6, 2023
76f82e0
Changed config.ini op serv url.
mariacarmina Mar 6, 2023
3488866
modified c2d envs.
mariacarmina Mar 6, 2023
a111e93
Updated config.ini
mariacarmina Mar 6, 2023
1d4f549
refactor tweak.
mariacarmina Mar 6, 2023
d5c0a6b
print url.
mariacarmina Mar 6, 2023
39b7bf4
updated url for c2d envs.
mariacarmina Mar 6, 2023
26bdb13
revert changes. added slash
mariacarmina Mar 6, 2023
8417c57
tweak
mariacarmina Mar 6, 2023
6507dfa
tweak 22.
mariacarmina Mar 6, 2023
f5c9781
revert
mariacarmina Mar 6, 2023
8255033
fix web3 package path.
mariacarmina Mar 7, 2023
c2dcb39
added a dict
mariacarmina Mar 7, 2023
e595fe1
more changes
mariacarmina Mar 7, 2023
19d925f
changed into capital T.
mariacarmina Mar 7, 2023
8107a13
removed additional dict
mariacarmina Mar 7, 2023
c414447
added connection close back.
mariacarmina Mar 7, 2023
69e9144
check fw.
mariacarmina Mar 7, 2023
c58ab62
Check with updated op serv.
mariacarmina Mar 7, 2023
707f5a5
added prints. modified workflow
mariacarmina Mar 7, 2023
1e8fc1a
tinny fix.
mariacarmina Mar 7, 2023
fe7930e
eval.
mariacarmina Mar 7, 2023
5ace7bd
debug string format.
mariacarmina Mar 7, 2023
87ed8b9
tweak 3
mariacarmina Mar 7, 2023
081cc86
removed eval.
mariacarmina Mar 8, 2023
cd442c7
removed string escape.
mariacarmina Mar 8, 2023
20c8433
removed urljoin. updated workflow.
mariacarmina Mar 8, 2023
96fa409
Update pytest.yml
calina-c Mar 9, 2023
bddb25f
Update pytest.yml
calina-c Mar 9, 2023
9a5589f
Merging. Resolved conflicts. Imported requests.
mariacarmina Mar 13, 2023
2447619
Merge branch 'debug' of github.com:oceanprotocol/provider into debug
mariacarmina Mar 13, 2023
a62e1b3
added user agent
mariacarmina Mar 13, 2023
6887a5c
fix pytest skip
mariacarmina Mar 13, 2023
914ff45
add e different version of python.
mariacarmina Mar 13, 2023
8191714
add docker ps.
mariacarmina Mar 13, 2023
073445a
tweaks to the workflow.
mariacarmina Mar 13, 2023
4ec38f2
stop fw.
mariacarmina Mar 13, 2023
1ee27e5
add traceroute
mariacarmina Mar 13, 2023
a0a899e
add traceroute host
mariacarmina Mar 13, 2023
37b3135
chaned op serv url.
mariacarmina Mar 13, 2023
7b87b6b
remove stop fw.
mariacarmina Mar 13, 2023
39ca968
remove traceroute
mariacarmina Mar 13, 2023
5bd28f5
added self hosted runner.
mariacarmina Mar 13, 2023
4c437ad
revert code changes from debug process.
mariacarmina Mar 13, 2023
5ec5752
Adapted for this branch.
mariacarmina Mar 13, 2023
58d55b5
removed docker ps.
mariacarmina Mar 13, 2023
f738c53
downgrade ubuntu.
mariacarmina Mar 13, 2023
8c67a2f
added back self-hosted runner.
mariacarmina Mar 14, 2023
51ba35e
Merge branch 'main' into debug
mariacarmina Mar 14, 2023
f516e81
Try with a larger runner.
mariacarmina Mar 14, 2023
0ad4ff0
try with ubuntu 22 with 4 cores.
mariacarmina Mar 14, 2023
1ceef60
Return to self-hosted env.
mariacarmina Mar 14, 2023
1c33e53
Resolved conflicts.
mariacarmina Apr 3, 2023
b733187
Removed tests for debugging.
mariacarmina Apr 3, 2023
6ff9dd3
Deleted more tests.
mariacarmina Apr 3, 2023
9b33877
Removed the graph from CI.
mariacarmina Apr 3, 2023
5cd5402
Added back the tests.
mariacarmina Apr 3, 2023
242639a
Test only download.
mariacarmina Apr 4, 2023
a409d23
Fixed workflow.
mariacarmina Apr 4, 2023
d4ef2a7
Test only encryption.
mariacarmina Apr 4, 2023
ba6c343
Test only fileinfo.
mariacarmina Apr 4, 2023
1eb2470
Test only graphql tests.
mariacarmina Apr 4, 2023
8213018
Deleted graphql tests. UpTest only initialize.
mariacarmina Apr 4, 2023
7c16484
Added socket test. Added timestamps to each test.
mariacarmina Apr 5, 2023
43776d6
Decresed number of retries.
mariacarmina Apr 5, 2023
bf9f134
Added back graphql. Modified workflow to skip subgraph deployment.
mariacarmina Apr 7, 2023
6627d7e
black.
mariacarmina Apr 7, 2023
17f0a11
Commented mint_fake_ocean.
mariacarmina Apr 10, 2023
41bdeed
replace with print.
mariacarmina Apr 11, 2023
dda2469
Test only one test.
mariacarmina Apr 11, 2023
bd10575
Test the ipfs url test.
mariacarmina Apr 11, 2023
8dc44db
Added logs for ipfs.
mariacarmina Apr 11, 2023
aa1a6e3
Modified ipfs test.
mariacarmina Apr 11, 2023
f3f53fc
Updated ipfs test.
mariacarmina Apr 11, 2023
9efdea9
black.
mariacarmina Apr 11, 2023
6eefaec
Removed prints. Mint datatokens. Removed helper function.
mariacarmina Apr 11, 2023
1cf05ce
Run the whole test suite.
mariacarmina Apr 11, 2023
fd0ab23
Merge branch 'main' into debug
mariacarmina Apr 11, 2023
c5c6102
Tested just graphql.
mariacarmina Apr 11, 2023
e673b33
Added full graph deployment.
mariacarmina Apr 11, 2023
0c9eba8
Added tests back.
mariacarmina Apr 11, 2023
a1dcc93
Removed pytest.skip.
mariacarmina Apr 11, 2023
a1c5aee
Rename script. Modified graphql test.
mariacarmina Apr 11, 2023
629c89e
Replaced subgraph URL.
mariacarmina Apr 13, 2023
2089482
Adapted test with parameterized query. Added aquarius URL back.
mariacarmina Apr 13, 2023
c91a487
Merge branch 'main' into debug
mariacarmina Apr 13, 2023
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
22 changes: 14 additions & 8 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,33 @@ jobs:
- name: Run Barge
working-directory: ${{ github.workspace }}/barge
run: |
bash -x start_ocean.sh --no-dashboard 2>&1 --with-rbac --with-provider2 --with-c2d --with-thegraph > start_ocean.log &
- name: Install dependencies
working-directory: ${{ github.workspace }}
run: |
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
bash -x start_ocean.sh --no-dashboard 2>&1 --with-rbac --with-provider2 --with-c2d --with-thegraph --skip-subgraph-deploy > start_ocean.log &
- name: Wait for contracts deployment and C2D cluster to be ready
working-directory: ${{ github.workspace }}/barge
run: |
for i in $(seq 1 250); do
sleep 10
[ -f "$HOME/.ocean/ocean-contracts/artifacts/ready" -a -f "$HOME/.ocean/ocean-c2d/ready" ] && break
done

- name: Verify deployments
run: |
netstat -lnpt
nc -zv 172.15.0.13 31000
cat $HOME/.ocean/ocean-contracts/artifacts/address.json
curl http://172.15.0.13:31000
nc -zv 172.15.0.16 8080
- name: Install dependencies
working-directory: ${{ github.workspace }}
run: |
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
- name: Test with pytest
run: |
coverage run --source ocean_provider -m pytest
coverage report
coverage xml
- name: docker logs
run: docker logs ocean_aquarius_1 && docker logs ocean_provider_1 && docker logs ocean_provider2_1
run: docker logs ocean_aquarius_1 && docker logs ocean_provider_1 && docker logs ocean_provider2_1 && docker logs ocean_ipfs_1
if: ${{ failure() }}
- name: Publish code coverage
uses: paambaati/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion compose-env-values
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PROVIDER_ADDRESS=068ed00cf0441e4829d9784fcbe7b9e26d4bd8d0
NETWORK_URL=wss://rinkeby.infura.io/ws/v3/357f2fe737db4304bd2f7285c5602d0d
AQUARIUS_URL=https://aquarius.marketplace.dev-ocean.com
calina-c marked this conversation as resolved.
Show resolved Hide resolved
OCEAN_PROVIDER_URL=http://0.0.0.0:8030
OPERATOR_SERVICE_URL=https://operator-api.operator.dev-ocean.com/
OPERATOR_SERVICE_URL=https://stagev4.c2d.oceanprotocol.com

AZURE_ACCOUNT_NAME=
AZURE_ACCOUNT_KEY=
Expand Down
10 changes: 2 additions & 8 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,13 @@ def web3():

@pytest.fixture
def free_c2d_env():
try:
environments = get_c2d_environments(flat=True)
except AssertionError:
pytest.skip("C2D connection failed. Need fix in #610")
environments = get_c2d_environments(flat=True)

return next(env for env in environments if float(env["priceMin"]) == float(0))


@pytest.fixture
def paid_c2d_env():
try:
environments = get_c2d_environments(flat=True)
except AssertionError:
pytest.skip("C2D connection failed. Need fix in #610")
environments = get_c2d_environments(flat=True)

return next(env for env in environments if env["id"] == "ocean-compute-env2")
2 changes: 1 addition & 1 deletion ocean_provider/utils/basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def get_configured_chains():

if not decoded:
web3 = get_web3(os.environ.get("NETWORK_URL"))
return [web3.chain_id]
return [web3.eth.chain_id]

return [int(key) for key in decoded.keys()]

Expand Down
3 changes: 2 additions & 1 deletion ocean_provider/utils/compute_environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from urllib.parse import urljoin

import requests

from ocean_provider.requests_session import get_requests_session
from ocean_provider.utils.address import get_provider_fee_token
from ocean_provider.utils.basics import get_configured_chains
Expand All @@ -17,7 +18,7 @@ def get_c2d_environments(flat=False):
if not os.getenv("OPERATOR_SERVICE_URL"):
return []

standard_headers = {"Content-type": "application/json", "Connection": "close"}
standard_headers = {"Content-Type": "application/json", "Connection": "close"}
all_environments = [] if flat else {}

for chain in get_configured_chains():
Expand Down
2 changes: 1 addition & 1 deletion start_provider.sh → start_local_provider.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
export PROVIDER_PRIVATE_KEY=0xfd5c1ccea015b6d663618850824154a3b3fb2882c46cefb05b9a93fea8c3d215
export TEST_PRIVATE_KEY1=0xef4b441145c1d0f3b4bc6d61d29f5c6e502359481152f869247c7a4244d45209
export TEST_PRIVATE_KEY2=0x5d75837394b078ce97bc289fa8d75e21000573520bfa7784a9d28ccaae602bf8
export OPERATOR_SERVICE_URL=https://c2d-dev.operator.oceanprotocol.com/
export OPERATOR_SERVICE_URL=http://172.15.0.13:31000
export ADDRESS_FILE=~/.ocean/ocean-contracts/artifacts/address.json
export IPFS_GATEWAY=http://172.15.0.16:8080
export AUTHORIZED_DECRYPTERS=[]
Expand Down
12 changes: 0 additions & 12 deletions tests/test_compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
get_registered_asset,
mint_100_datatokens,
post_to_compute,
skip_on,
start_order,
)
from tests.helpers.ddo_dict_builders import build_metadata_dict_type_algorithm
Expand All @@ -44,7 +43,6 @@ def test_compute_rejected(client, monkeypatch):

@pytest.mark.integration
@pytest.mark.parametrize("allow_raw_algos", [True, False])
@skip_on(AssertionError, "C2D connection failed. Need fix in #610")
def test_compute_raw_algo(
client,
publisher_wallet,
Expand Down Expand Up @@ -120,7 +118,6 @@ def test_compute_raw_algo(


@pytest.mark.integration
@skip_on(AssertionError, "C2D connection failed. Need fix in #610")
def test_compute_specific_algo_dids(
client, publisher_wallet, consumer_wallet, consumer_address, free_c2d_env
):
Expand Down Expand Up @@ -166,7 +163,6 @@ def test_compute_specific_algo_dids(


@pytest.mark.integration
@skip_on(AssertionError, "C2D connection failed. Need fix in #610")
def test_compute(client, publisher_wallet, consumer_wallet, free_c2d_env):
valid_until = get_future_valid_until()
ddo, tx_id, alg_ddo, alg_tx_id = build_and_send_ddo_with_compute_service(
Expand Down Expand Up @@ -293,7 +289,6 @@ def test_compute(client, publisher_wallet, consumer_wallet, free_c2d_env):


@pytest.mark.integration
@skip_on(AssertionError, "C2D connection failed. Need fix in #610")
def test_compute_arweave(client, publisher_wallet, consumer_wallet, free_c2d_env):
valid_until = get_future_valid_until()
ddo, tx_id, alg_ddo, alg_tx_id = build_and_send_ddo_with_compute_service(
Expand Down Expand Up @@ -331,7 +326,6 @@ def test_compute_arweave(client, publisher_wallet, consumer_wallet, free_c2d_env


@pytest.mark.integration
@skip_on(requests.exceptions.ConnectionError, "C2D connection failed. Need fix in #610")
def test_compute_diff_provider(client, publisher_wallet, consumer_wallet, free_c2d_env):
valid_until = get_future_valid_until()
ddo, tx_id, alg_ddo, alg_tx_id = build_and_send_ddo_with_compute_service(
Expand Down Expand Up @@ -367,7 +361,6 @@ def test_compute_diff_provider(client, publisher_wallet, consumer_wallet, free_c


@pytest.mark.integration
@skip_on(requests.exceptions.ConnectionError, "C2D connection failed. Need fix in #610")
def test_compute_allow_all_published(
client, publisher_wallet, consumer_wallet, free_c2d_env
):
Expand Down Expand Up @@ -415,7 +408,6 @@ def test_compute_allow_all_published(


@pytest.mark.integration
@skip_on(requests.exceptions.ConnectionError, "C2D connection failed. Need fix in #610")
def test_compute_additional_input(
client, publisher_wallet, consumer_wallet, monkeypatch, free_c2d_env, web3
):
Expand Down Expand Up @@ -501,7 +493,6 @@ def test_compute_additional_input(


@pytest.mark.integration
@skip_on(requests.exceptions.ConnectionError, "C2D connection failed. Need fix in #610")
def test_compute_delete_job(
client, publisher_wallet, consumer_wallet, consumer_address, free_c2d_env
):
Expand Down Expand Up @@ -567,7 +558,6 @@ def test_compute_delete_job(


@pytest.mark.unit
@skip_on(AssertionError, "C2D connection failed. Need fix in #610")
def test_compute_environments():
environments = get_c2d_environments()

Expand All @@ -577,7 +567,6 @@ def test_compute_environments():


@pytest.mark.integration
@skip_on(requests.exceptions.ConnectionError, "C2D connection failed. Need fix in #610")
def test_compute_paid_env(
client, publisher_wallet, consumer_wallet, paid_c2d_env, web3
):
Expand Down Expand Up @@ -627,7 +616,6 @@ def test_compute_paid_env(


@pytest.mark.integration
@skip_on(requests.exceptions.ConnectionError, "C2D connection failed. Need fix in #610")
def test_compute_auth_token(client, publisher_wallet, consumer_wallet, free_c2d_env):
valid_until = get_future_valid_until()
ddo, tx_id, alg_ddo, alg_tx_id = build_and_send_ddo_with_compute_service(
Expand Down
45 changes: 22 additions & 23 deletions tests/test_graphql.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ def test_download_graphql_asset(client, publisher_wallet, consumer_wallet, web3)
unencrypted_files_list = [
{
"type": "graphql",
"url": "http://172.15.0.15:8000/subgraphs/name/oceanprotocol/ocean-subgraph",
"url": "http://172.15.0.15:8030/graphql",
"query": """
query{
nfts(orderBy: createdTimestamp,orderDirection:desc){
id
symbol
createdTimestamp
query {
indexingStatuses {
subgraph
chains
node
}
}
}
""",
""",
}
]
asset = get_registered_asset(
Expand Down Expand Up @@ -79,15 +79,15 @@ def test_download_graphql_asset_with_userdata(
unencrypted_files_list = [
{
"type": "graphql",
"url": "http://172.15.0.15:8000/subgraphs/name/oceanprotocol/ocean-subgraph",
"url": "http://172.15.0.15:8030/graphql",
"query": """
query nfts($nftAddress: String){
mariacarmina marked this conversation as resolved.
Show resolved Hide resolved
nfts(where: {id:$nftAddress},orderBy: createdTimestamp,orderDirection:desc){
id
symbol
createdTimestamp
query GetSubgraph($name: [String!]){
indexingStatuses(subgraphs: $name) {
subgraph
chains
node
}
}
}
""",
}
]
Expand All @@ -96,11 +96,12 @@ def test_download_graphql_asset_with_userdata(
unencrypted_files_list=unencrypted_files_list,
custom_userdata=[
{
"name": "nftAddress",
"name": "name",
"type": "text",
"label": "nftAddress",
"label": "name",
"required": True,
"description": "Nft to search for",
"description": "Subgraph indexing status",
"default": ["subgraph"],
}
],
)
Expand All @@ -123,7 +124,7 @@ def test_download_graphql_asset_with_userdata(
"consumerAddress": consumer_wallet.address,
"transferTxId": tx_id,
"fileIndex": 0,
"userdata": json.dumps({"nftAddress": asset.nftAddress.lower()}),
"userdata": json.dumps({"name": ["subgraph"]}),
}

download_endpoint = BaseURLs.SERVICES_URL + "/download"
Expand All @@ -137,7 +138,5 @@ def test_download_graphql_asset_with_userdata(
)
assert response.status_code == 200, f"{response.data}"
reply = json.loads(response.data)
assert (
len(reply["data"]["nfts"]) == 1
) # make sure our parametrized query works, otherwise we will get a lot of nfts
assert reply["data"]["nfts"][0]["id"] == asset.nftAddress.lower()
assert len(reply["data"]) == 1
assert "indexingStatuses" in reply["data"].keys()
9 changes: 0 additions & 9 deletions tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,15 +407,6 @@ def get_dataset_with_invalid_url_ddo(client, wallet):
)


def get_dataset_with_ipfs_url_ddo(client, wallet):
return get_registered_asset(
wallet,
unencrypted_files_list=[
{"type": "ipfs", "hash": "QmXtkGkWCG47tVpiBr8f5FdHuCMPq8h2jhck4jgjSXKiWZ"}
],
)


def get_resource_path(dir_name, file_name):
base = os.path.realpath(__file__).split(os.path.sep)[1:-1]
if dir_name:
Expand Down
Loading