Skip to content

Commit

Permalink
Confirmation time default (#271)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
eccles authored Aug 23, 2024
1 parent e0fd7c7 commit e533cdf
Show file tree
Hide file tree
Showing 22 changed files with 18 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 0 additions & 5 deletions archivist/notebooks/Checking the Dog's Weight.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 0 additions & 2 deletions archivist/notebooks/Create Event with Verified Domain.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 0 additions & 5 deletions archivist/notebooks/Feeding the Dog Hourly.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 0 additions & 5 deletions archivist/notebooks/Feeding the Dog in a Timely Manner.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 0 additions & 5 deletions archivist/notebooks/Feeding the Dog.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 0 additions & 3 deletions archivist/notebooks/Find Artist and Create Cover Art.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 0 additions & 2 deletions archivist/notebooks/Manage_Credentials.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
"\n",
"from os import getenv\n",
"\n",
"from dotenv import load_dotenv\n",
"\n",
"from archivist.archivist import Archivist"
]
},
Expand Down
5 changes: 0 additions & 5 deletions archivist/notebooks/Playing Fetch Every 5 Minutes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand Down
9 changes: 2 additions & 7 deletions archivist/notebooks/Sharing Artist Asset with User.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand Down
1 change: 0 additions & 1 deletion docs/logger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
18 changes: 9 additions & 9 deletions examples/create_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions functests/execassets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion functests/execpublicassets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion functests/execrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion unittests/testassetsconstants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit e533cdf

Please sign in to comment.