From e533cdf221a17cf705cb35c9553e656c4e731a32 Mon Sep 17 00:00:00 2001 From: Paul Hewlett <1104895+eccles@users.noreply.github.com> Date: Fri, 23 Aug 2024 17:31:34 +0100 Subject: [PATCH] Confirmation time default (#271) A number of places set the wrong default confirmation time of 30s instead of 300s Additionally latest linter highlighted incorrect and unused imports in notebooks. AB#9779 --- ...ance using CURRENT OUTSTANDING Policy.ipynb | 2 -- ...k Asset Compliance using SINCE Policy.ipynb | 2 -- .../notebooks/Checking the Dog's Weight.ipynb | 5 ----- .../Create Artist and Album Release Info.ipynb | 5 ----- .../Create Event with Verified Domain.ipynb | 2 -- .../notebooks/Feeding the Dog Hourly.ipynb | 5 ----- .../Feeding the Dog in a Timely Manner.ipynb | 5 ----- archivist/notebooks/Feeding the Dog.ipynb | 5 ----- ...ist and Additional Album Release Info.ipynb | 3 --- .../Find Artist and Create Cover Art.ipynb | 3 --- archivist/notebooks/Manage_Credentials.ipynb | 2 -- .../Playing Fetch Every 5 Minutes.ipynb | 5 ----- ...Album Release Info with Record Labels.ipynb | 9 ++------- .../Sharing Album Release Info with User.ipynb | 9 ++------- ...aring Artist Asset with Record Labels.ipynb | 9 ++------- .../Sharing Artist Asset with User.ipynb | 9 ++------- docs/logger.rst | 1 - examples/create_asset.py | 18 +++++++++--------- functests/execassets.py | 2 -- functests/execpublicassets.py | 1 - functests/execrunner.py | 1 - unittests/testassetsconstants.py | 2 +- 22 files changed, 18 insertions(+), 87 deletions(-) diff --git a/archivist/notebooks/Check Asset Compliance using CURRENT OUTSTANDING Policy.ipynb b/archivist/notebooks/Check Asset Compliance using CURRENT OUTSTANDING Policy.ipynb index 9dd240e0..cdf29c18 100644 --- a/archivist/notebooks/Check Asset Compliance using CURRENT OUTSTANDING Policy.ipynb +++ b/archivist/notebooks/Check Asset Compliance using CURRENT OUTSTANDING Policy.ipynb @@ -35,8 +35,6 @@ "from uuid import uuid4\n", "from warnings import filterwarnings\n", "\n", - "from dotenv import load_dotenv\n", - "\n", "from archivist.archivist import Archivist\n", "from archivist.compliance_policy_requests import CompliancePolicyCurrentOutstanding\n", "from archivist.constants import ASSET_BEHAVIOURS\n", diff --git a/archivist/notebooks/Check Asset Compliance using SINCE Policy.ipynb b/archivist/notebooks/Check Asset Compliance using SINCE Policy.ipynb index 60649059..8439540d 100644 --- a/archivist/notebooks/Check Asset Compliance using SINCE Policy.ipynb +++ b/archivist/notebooks/Check Asset Compliance using SINCE Policy.ipynb @@ -37,8 +37,6 @@ "from uuid import uuid4\n", "from warnings import filterwarnings\n", "\n", - "from dotenv import load_dotenv\n", - "\n", "from archivist.archivist import Archivist\n", "from archivist.compliance_policy_requests import (\n", " CompliancePolicySince,\n", diff --git a/archivist/notebooks/Checking the Dog's Weight.ipynb b/archivist/notebooks/Checking the Dog's Weight.ipynb index 33760334..eadd1bfc 100644 --- a/archivist/notebooks/Checking the Dog's Weight.ipynb +++ b/archivist/notebooks/Checking the Dog's Weight.ipynb @@ -35,14 +35,9 @@ "metadata": {}, "outputs": [], "source": [ - "import random\n", - "import string\n", "\n", "from json import dumps as json_dumps\n", "from os import getenv\n", - "from warnings import filterwarnings\n", - "\n", - "from dotenv import load_dotenv\n", "\n", "from archivist.archivist import Archivist\n", "from archivist.compliance_policy_requests import (\n", diff --git a/archivist/notebooks/Create Artist and Album Release Info.ipynb b/archivist/notebooks/Create Artist and Album Release Info.ipynb index 9a59df73..ec11f97f 100644 --- a/archivist/notebooks/Create Artist and Album Release Info.ipynb +++ b/archivist/notebooks/Create Artist and Album Release Info.ipynb @@ -34,14 +34,9 @@ "metadata": {}, "outputs": [], "source": [ - "import random\n", - "import string\n", "\n", "from json import dumps as json_dumps\n", "from os import getenv\n", - "from warnings import filterwarnings\n", - "\n", - "from dotenv import load_dotenv\n", "\n", "from archivist.archivist import Archivist\n", "from archivist.logger import set_logger" diff --git a/archivist/notebooks/Create Event with Verified Domain.ipynb b/archivist/notebooks/Create Event with Verified Domain.ipynb index e0e6ebcf..960acb59 100644 --- a/archivist/notebooks/Create Event with Verified Domain.ipynb +++ b/archivist/notebooks/Create Event with Verified Domain.ipynb @@ -42,8 +42,6 @@ "from os import getenv\n", "from warnings import filterwarnings\n", "\n", - "from dotenv import load_dotenv\n", - "\n", "from archivist.archivist import Archivist\n", "from archivist.logger import set_logger\n", "\n", diff --git a/archivist/notebooks/Feeding the Dog Hourly.ipynb b/archivist/notebooks/Feeding the Dog Hourly.ipynb index 1f8b131b..5e796c94 100644 --- a/archivist/notebooks/Feeding the Dog Hourly.ipynb +++ b/archivist/notebooks/Feeding the Dog Hourly.ipynb @@ -35,14 +35,9 @@ "metadata": {}, "outputs": [], "source": [ - "import random\n", - "import string\n", "\n", "from json import dumps as json_dumps\n", "from os import getenv\n", - "from warnings import filterwarnings\n", - "\n", - "from dotenv import load_dotenv\n", "\n", "from archivist.archivist import Archivist\n", "from archivist.compliance_policy_requests import (\n", diff --git a/archivist/notebooks/Feeding the Dog in a Timely Manner.ipynb b/archivist/notebooks/Feeding the Dog in a Timely Manner.ipynb index 28a54c8f..f15b6b45 100644 --- a/archivist/notebooks/Feeding the Dog in a Timely Manner.ipynb +++ b/archivist/notebooks/Feeding the Dog in a Timely Manner.ipynb @@ -35,14 +35,9 @@ "metadata": {}, "outputs": [], "source": [ - "import random\n", - "import string\n", "\n", "from json import dumps as json_dumps\n", "from os import getenv\n", - "from warnings import filterwarnings\n", - "\n", - "from dotenv import load_dotenv\n", "\n", "from archivist.archivist import Archivist\n", "from archivist.compliance_policy_requests import (\n", diff --git a/archivist/notebooks/Feeding the Dog.ipynb b/archivist/notebooks/Feeding the Dog.ipynb index 846e64ad..557dc8bc 100644 --- a/archivist/notebooks/Feeding the Dog.ipynb +++ b/archivist/notebooks/Feeding the Dog.ipynb @@ -35,14 +35,9 @@ "metadata": {}, "outputs": [], "source": [ - "import random\n", - "import string\n", "\n", "from json import dumps as json_dumps\n", "from os import getenv\n", - "from warnings import filterwarnings\n", - "\n", - "from dotenv import load_dotenv\n", "\n", "from archivist.archivist import Archivist\n", "from archivist.compliance_policy_requests import (\n", diff --git a/archivist/notebooks/Find Artist and Additional Album Release Info.ipynb b/archivist/notebooks/Find Artist and Additional Album Release Info.ipynb index 8278fd5f..920cd840 100644 --- a/archivist/notebooks/Find Artist and Additional Album Release Info.ipynb +++ b/archivist/notebooks/Find Artist and Additional Album Release Info.ipynb @@ -36,9 +36,6 @@ "source": [ "from json import dumps as json_dumps\n", "from os import getenv\n", - "from warnings import filterwarnings\n", - "\n", - "from dotenv import load_dotenv\n", "\n", "from archivist.archivist import Archivist\n", "from archivist.logger import set_logger" diff --git a/archivist/notebooks/Find Artist and Create Cover Art.ipynb b/archivist/notebooks/Find Artist and Create Cover Art.ipynb index 8a044255..9197bde0 100644 --- a/archivist/notebooks/Find Artist and Create Cover Art.ipynb +++ b/archivist/notebooks/Find Artist and Create Cover Art.ipynb @@ -36,9 +36,6 @@ "source": [ "from json import dumps as json_dumps\n", "from os import getenv\n", - "from warnings import filterwarnings\n", - "\n", - "from dotenv import load_dotenv\n", "\n", "from archivist.archivist import Archivist\n", "from archivist.logger import set_logger" diff --git a/archivist/notebooks/Manage_Credentials.ipynb b/archivist/notebooks/Manage_Credentials.ipynb index 1671e4fb..0de0ad65 100644 --- a/archivist/notebooks/Manage_Credentials.ipynb +++ b/archivist/notebooks/Manage_Credentials.ipynb @@ -26,8 +26,6 @@ "\n", "from os import getenv\n", "\n", - "from dotenv import load_dotenv\n", - "\n", "from archivist.archivist import Archivist" ] }, diff --git a/archivist/notebooks/Playing Fetch Every 5 Minutes.ipynb b/archivist/notebooks/Playing Fetch Every 5 Minutes.ipynb index b2b588ed..e79cb931 100644 --- a/archivist/notebooks/Playing Fetch Every 5 Minutes.ipynb +++ b/archivist/notebooks/Playing Fetch Every 5 Minutes.ipynb @@ -35,14 +35,9 @@ "metadata": {}, "outputs": [], "source": [ - "import random\n", - "import string\n", "\n", "from json import dumps as json_dumps\n", "from os import getenv\n", - "from warnings import filterwarnings\n", - "\n", - "from dotenv import load_dotenv\n", "\n", "from archivist.archivist import Archivist\n", "from archivist.compliance_policy_requests import (\n", diff --git a/archivist/notebooks/Sharing Album Release Info with Record Labels.ipynb b/archivist/notebooks/Sharing Album Release Info with Record Labels.ipynb index eac2895d..71e6df17 100644 --- a/archivist/notebooks/Sharing Album Release Info with Record Labels.ipynb +++ b/archivist/notebooks/Sharing Album Release Info with Record Labels.ipynb @@ -40,18 +40,13 @@ "metadata": {}, "outputs": [], "source": [ - "import random\n", - "import string\n", "\n", "from json import dumps as json_dumps\n", "from os import getenv\n", - "from warnings import filterwarnings\n", - "\n", - "from dotenv import load_dotenv\n", "\n", "from archivist.archivist import Archivist\n", - "from archivist.logger import set_logger\n", - "from archivist.constants import ASSET_BEHAVIOURS" + "from archivist.constants import ASSET_BEHAVIOURS\n", + "from archivist.logger import set_logger" ] }, { diff --git a/archivist/notebooks/Sharing Album Release Info with User.ipynb b/archivist/notebooks/Sharing Album Release Info with User.ipynb index 13bf7b7c..3ca97268 100644 --- a/archivist/notebooks/Sharing Album Release Info with User.ipynb +++ b/archivist/notebooks/Sharing Album Release Info with User.ipynb @@ -34,18 +34,13 @@ "metadata": {}, "outputs": [], "source": [ - "import random\n", - "import string\n", "\n", "from json import dumps as json_dumps\n", "from os import getenv\n", - "from warnings import filterwarnings\n", - "\n", - "from dotenv import load_dotenv\n", "\n", "from archivist.archivist import Archivist\n", - "from archivist.logger import set_logger\n", - "from archivist.constants import ASSET_BEHAVIOURS" + "from archivist.constants import ASSET_BEHAVIOURS\n", + "from archivist.logger import set_logger" ] }, { diff --git a/archivist/notebooks/Sharing Artist Asset with Record Labels.ipynb b/archivist/notebooks/Sharing Artist Asset with Record Labels.ipynb index 722254cf..fd144b4c 100644 --- a/archivist/notebooks/Sharing Artist Asset with Record Labels.ipynb +++ b/archivist/notebooks/Sharing Artist Asset with Record Labels.ipynb @@ -41,18 +41,13 @@ "metadata": {}, "outputs": [], "source": [ - "import random\n", - "import string\n", "\n", "from json import dumps as json_dumps\n", "from os import getenv\n", - "from warnings import filterwarnings\n", - "\n", - "from dotenv import load_dotenv\n", "\n", "from archivist.archivist import Archivist\n", - "from archivist.logger import set_logger\n", - "from archivist.constants import ASSET_BEHAVIOURS" + "from archivist.constants import ASSET_BEHAVIOURS\n", + "from archivist.logger import set_logger" ] }, { diff --git a/archivist/notebooks/Sharing Artist Asset with User.ipynb b/archivist/notebooks/Sharing Artist Asset with User.ipynb index ab6a1724..3b9a71e6 100644 --- a/archivist/notebooks/Sharing Artist Asset with User.ipynb +++ b/archivist/notebooks/Sharing Artist Asset with User.ipynb @@ -34,18 +34,13 @@ "metadata": {}, "outputs": [], "source": [ - "import random\n", - "import string\n", "\n", "from json import dumps as json_dumps\n", "from os import getenv\n", - "from warnings import filterwarnings\n", - "\n", - "from dotenv import load_dotenv\n", "\n", "from archivist.archivist import Archivist\n", - "from archivist.logger import set_logger\n", - "from archivist.constants import ASSET_BEHAVIOURS" + "from archivist.constants import ASSET_BEHAVIOURS\n", + "from archivist.logger import set_logger" ] }, { diff --git a/docs/logger.rst b/docs/logger.rst index 0eaf4643..521c2ad4 100644 --- a/docs/logger.rst +++ b/docs/logger.rst @@ -20,7 +20,6 @@ The first (optional) call from the archivist package is to set the logger. arch = Archivist( "https://app.datatrails.ai", (client_id, client_secret), - max_time=300, ) diff --git a/examples/create_asset.py b/examples/create_asset.py index 8c8ba78a..44655d77 100644 --- a/examples/create_asset.py +++ b/examples/create_asset.py @@ -55,6 +55,12 @@ def create_asset(arch): # If @confirm@ is True then this function will not # return until the asset is confirmed. # + # Confirmation guarantees that 3rd parties can retrieve and cryptographically + # verify your Events, which can take a few seconds to propagate. It is typically + # not necessary to wait unless your workflow involves near-real-time + # communication with 3rd parties and the 3rd party needs immediate cryptographic + # verification of your new Asset. + # return arch.assets.create(props=props, attrs=attrs, confirm=True) # alternatively if some work can be done whilst the asset is confirmed then this call can be # replaced by a two-step alternative: @@ -93,22 +99,16 @@ def main(): client_secret_filename=getenv("DATATRAILS_APPREG_SECRET_FILENAME"), ) - # Initialize connection to Archivist. max_time is the time to wait for confirmation - # of an asset or event creation - the default is 30 seconds but one can optionally + # Initialize connection to Archivist. max_time is the optional time to wait for confirmation + # of an asset or event creation - the default is 300 seconds but one can optionally # specify a different value. - # Confirmation guarantees that 3rd parties can retrieve and cryptographically - # verify your Events, which can take a few seconds to propagate. It is typically - # not necessary to wait unless your workflow involves near-real-time - # communication with 3rd parties and the 3rd party needs immediate cryptographic - # verification of your new Asset. - # The optional partner id field is allocated by Datatrails to partners - partners are then # expected to specify this value when submitting any request to the archivist product. # Leave blank if if you do not have a partner ID. with Archivist( "https://app.datatrails.ai", auth, - max_time=300, + max_time=100, partner_id="acme/f7a6beef-f01c-4b39-a494-3fa6b45d6bf4", ) as arch: # Create a new asset diff --git a/functests/execassets.py b/functests/execassets.py index 4af68878..c5942b50 100644 --- a/functests/execassets.py +++ b/functests/execassets.py @@ -94,7 +94,6 @@ def setUp(self): self.arch = Archivist( getenv("DATATRAILS_URL"), auth, - max_time=30, partner_id=PARTNER_ID_VALUE, ) self.arch.user_agent = USER_AGENT_VALUE @@ -250,7 +249,6 @@ def setUp(self): self.arch = Archivist( getenv("DATATRAILS_URL"), auth, - max_time=30, partner_id=PARTNER_ID_VALUE, ) self.arch.user_agent = USER_AGENT_VALUE diff --git a/functests/execpublicassets.py b/functests/execpublicassets.py index b4049171..fff6be65 100644 --- a/functests/execpublicassets.py +++ b/functests/execpublicassets.py @@ -91,7 +91,6 @@ def setUp(self): self.arch = Archivist( getenv("DATATRAILS_URL"), auth, - max_time=30, partner_id=PARTNER_ID_VALUE, ) self.arch.user_agent = USER_AGENT_VALUE diff --git a/functests/execrunner.py b/functests/execrunner.py index c4dbd5e8..58611193 100644 --- a/functests/execrunner.py +++ b/functests/execrunner.py @@ -46,7 +46,6 @@ def setUp(self): self.arch = Archivist( getenv("DATATRAILS_URL"), auth, - max_time=30, partner_id=PARTNER_ID_VALUE, ) self.arch.user_agent = USER_AGENT_VALUE diff --git a/unittests/testassetsconstants.py b/unittests/testassetsconstants.py index 54e28a93..f3cae5b0 100644 --- a/unittests/testassetsconstants.py +++ b/unittests/testassetsconstants.py @@ -538,7 +538,7 @@ class TestAssetsBaseConfirm(TestCase): maxDiff = None def setUp(self): - self.arch = Archivist("url", "authauthauth", max_time=30) + self.arch = Archivist("url", "authauthauth") def tearDown(self): self.arch.close()