Skip to content

Commit 2500998

Browse files
committed
#10 - Save point
1 parent 4969042 commit 2500998

29 files changed

+91
-53
lines changed

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,11 @@ dmypy.json
127127

128128
# Pyre type checker
129129
.pyre/
130-
.history
130+
.history
131+
132+
# VSCode
133+
.vscode/
134+
.history
135+
136+
# Output folder used by examples
137+
resources/output/

python/configuration/add_data_sources.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
from pathlib import Path
66

77
from senzing import SzError
8-
from senzing_core import SzAbstractFactory
8+
from senzing_core import SzAbstractFactoryCore
99

1010
ENGINE_CONFIG_JSON = os.getenv("SENZING_ENGINE_CONFIGURATION_JSON", "{}")
1111
INSTANCE_NAME = Path(__file__).stem
1212

1313

1414
try:
15-
sz_factory = SzAbstractFactory("add_records", ENGINE_CONFIG_JSON, verbose_logging=False)
15+
sz_factory = SzAbstractFactoryCore("add_records", ENGINE_CONFIG_JSON, verbose_logging=False)
1616
sz_config = sz_factory.create_config()
1717
sz_configmanager = sz_factory.create_configmanager()
1818

python/deleting/delete_futures.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from pathlib import Path
99

1010
from senzing import SzBadInputError, SzError, SzRetryableError, SzUnrecoverableError
11-
from senzing_core import SzAbstractFactory
11+
from senzing_core import SzAbstractFactoryCore
1212

1313
ENGINE_CONFIG_JSON = os.getenv("SENZING_ENGINE_CONFIGURATION_JSON", "{}")
1414
INPUT_FILE = Path("../../resources/data/del-500.jsonl").resolve()
@@ -68,7 +68,7 @@ def futures_del(engine, input_file):
6868

6969

7070
try:
71-
sz_factory = SzAbstractFactory(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
71+
sz_factory = SzAbstractFactoryCore(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
7272
sz_engine = sz_factory.create_engine()
7373
futures_del(sz_engine, INPUT_FILE)
7474
except SzError as err:

python/deleting/delete_loop.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pathlib import Path
77

88
from senzing import SzBadInputError, SzError, SzRetryableError, SzUnrecoverableError
9-
from senzing_core import SzAbstractFactory
9+
from senzing_core import SzAbstractFactoryCore
1010

1111
ENGINE_CONFIG_JSON = os.getenv("SENZING_ENGINE_CONFIGURATION_JSON", "{}")
1212
INPUT_FILE = Path("../../resources/data/del-500.jsonl").resolve()
@@ -49,7 +49,7 @@ def del_records_from_file(engine, input_file):
4949

5050

5151
try:
52-
sz_factory = SzAbstractFactory(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
52+
sz_factory = SzAbstractFactoryCore(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
5353
sz_engine = sz_factory.create_engine()
5454
del_records_from_file(sz_engine, INPUT_FILE)
5555
except SzError as err:

python/deleting/delete_with_info_futures.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
SzRetryableError,
1515
SzUnrecoverableError,
1616
)
17-
from senzing_core import SzAbstractFactory
17+
from senzing_core import SzAbstractFactoryCore
1818

1919
ENGINE_CONFIG_JSON = os.getenv("SENZING_ENGINE_CONFIGURATION_JSON", "{}")
2020
INPUT_FILE = Path("../../resources/data/del-500.jsonl").resolve()
@@ -79,7 +79,7 @@ def futures_del(engine, input_file, output_file):
7979

8080

8181
try:
82-
sz_factory = SzAbstractFactory(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
82+
sz_factory = SzAbstractFactoryCore(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
8383
sz_engine = sz_factory.create_engine()
8484
futures_del(sz_engine, INPUT_FILE, OUTPUT_FILE)
8585
except SzError as err:

python/information/check_datastore_performance.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
from pathlib import Path
55

66
from senzing import SzError
7-
from senzing_core import SzAbstractFactory
7+
from senzing_core import SzAbstractFactoryCore
88

99
ENGINE_CONFIG_JSON = os.getenv("SENZING_ENGINE_CONFIGURATION_JSON", "{}")
1010
INSTANCE_NAME = Path(__file__).stem
1111
SECONDS_TO_RUN = 3
1212

1313
try:
14-
sz_factory = SzAbstractFactory(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
14+
sz_factory = SzAbstractFactoryCore(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
1515
sz_diagnostic = sz_factory.create_diagnostic()
1616
print(sz_diagnostic.check_datastore_performance(SECONDS_TO_RUN))
1717
except SzError as err:

python/information/get_datastore_info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
from pathlib import Path
55

66
from senzing import SzError
7-
from senzing_core import SzAbstractFactory
7+
from senzing_core import SzAbstractFactoryCore
88

99
ENGINE_CONFIG_JSON = os.getenv("SENZING_ENGINE_CONFIGURATION_JSON", "{}")
1010
INSTANCE_NAME = Path(__file__).stem
1111

1212
try:
13-
sz_factory = SzAbstractFactory(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
13+
sz_factory = SzAbstractFactoryCore(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
1414
sz_diagnostic = sz_factory.create_diagnostic()
1515
print(sz_diagnostic.get_datastore_info())
1616
except SzError as err:

python/information/get_license.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
from pathlib import Path
55

66
from senzing import SzError
7-
from senzing_core import SzAbstractFactory
7+
from senzing_core import SzAbstractFactoryCore
88

99
ENGINE_CONFIG_JSON = os.getenv("SENZING_ENGINE_CONFIGURATION_JSON", "{}")
1010
INSTANCE_NAME = Path(__file__).stem
1111

1212
try:
13-
sz_factory = SzAbstractFactory(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
13+
sz_factory = SzAbstractFactoryCore(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
1414
sz_product = sz_factory.create_product()
1515
print(sz_product.get_license())
1616
except SzError as err:

python/information/get_stats.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from pathlib import Path
99

1010
from senzing import SzBadInputError, SzError, SzRetryableError, SzUnrecoverableError
11-
from senzing_core import SzAbstractFactory
11+
from senzing_core import SzAbstractFactoryCore
1212

1313
ENGINE_CONFIG_JSON = os.getenv("SENZING_ENGINE_CONFIGURATION_JSON", "{}")
1414
INPUT_FILE = Path("../../resources/data/load-500.jsonl").resolve()
@@ -81,7 +81,7 @@ def futures_add(engine, input_file):
8181

8282

8383
try:
84-
sz_factory = SzAbstractFactory(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
84+
sz_factory = SzAbstractFactoryCore(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
8585
sz_engine = sz_factory.create_engine()
8686
futures_add(sz_engine, INPUT_FILE)
8787
except SzError as err:

python/information/get_version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
from pathlib import Path
55

66
from senzing import SzError
7-
from senzing_core import SzAbstractFactory
7+
from senzing_core import SzAbstractFactoryCore
88

99
ENGINE_CONFIG_JSON = os.getenv("SENZING_ENGINE_CONFIGURATION_JSON", "{}")
1010
INSTANCE_NAME = Path(__file__).stem
1111

1212
try:
13-
sz_factory = SzAbstractFactory(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
13+
sz_factory = SzAbstractFactoryCore(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
1414
sz_product = sz_factory.create_product()
1515
print(sz_product.get_version())
1616
except SzError as err:

python/initialization/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Snippets
44

5+
- **abstract_factory_parameters.py**
6+
- Used to create a dictionary that can be unpacked when creating an SzAbstractFactoryCore, also useful for type annotations
57
- **engine_priming.py**
68
- Priming the Senzing engine before use loads resource intensive assets upfront. Without priming the first SDK call to the engine will appear slower than usual as it causes these assets to be loaded
79
- **factory_and_engines.py**
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#! /usr/bin/env python3
2+
3+
4+
from senzing import SzError
5+
from senzing_core import SzAbstractFactoryCore, SzAbstractFactoryParametersCore
6+
7+
FACTORY_PARAMETERS: SzAbstractFactoryParametersCore = {
8+
"instance_name": "abstract_factory_parameters",
9+
"settings": {
10+
"PIPELINE": {
11+
"CONFIGPATH": "/etc/opt/senzing",
12+
"RESOURCEPATH": "/opt/senzing/er/resources",
13+
"SUPPORTPATH": "/opt/senzing/data",
14+
},
15+
"SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
16+
},
17+
"verbose_logging": 0,
18+
}
19+
20+
try:
21+
sz_factory = SzAbstractFactoryCore(**FACTORY_PARAMETERS)
22+
sz_config = sz_factory.create_config()
23+
sz_configmgr = sz_factory.create_configmanager()
24+
sz_diagnostic = sz_factory.create_diagnostic()
25+
sz_engine = sz_factory.create_engine()
26+
sz_product = sz_factory.create_product()
27+
# Do work...
28+
except SzError as err:
29+
print(f"\n{err.__class__.__name__} - {err}")

python/initialization/engine_priming.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
from pathlib import Path
55

66
from senzing import SzError
7-
from senzing_core import SzAbstractFactory
7+
from senzing_core import SzAbstractFactoryCore
88

99
ENGINE_CONFIG_JSON = os.getenv("SENZING_ENGINE_CONFIGURATION_JSON", "{}")
1010
INSTANCE_NAME = Path(__file__).stem
1111

1212
try:
13-
sz_factory = SzAbstractFactory(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
13+
sz_factory = SzAbstractFactoryCore(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
1414
sz_engine = sz_factory.create_engine()
1515
print("Priming Senzing engine...")
1616
sz_engine.prime_engine()

python/initialization/factory_and_engines.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
from pathlib import Path
55

66
from senzing import SzError
7-
from senzing_core import SzAbstractFactory
7+
from senzing_core import SzAbstractFactoryCore
88

99
ENGINE_CONFIG_JSON = os.getenv("SENZING_ENGINE_CONFIGURATION_JSON", "{}")
1010
INSTANCE_NAME = Path(__file__).stem
1111

1212
try:
13-
sz_factory = SzAbstractFactory(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
13+
sz_factory = SzAbstractFactoryCore(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
1414
sz_config = sz_factory.create_config()
1515
sz_configmgr = sz_factory.create_configmanager()
1616
sz_diagnostic = sz_factory.create_diagnostic()

python/initialization/purge_repository.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from pathlib import Path
66

77
from senzing import SzError
8-
from senzing_core import SzAbstractFactory
8+
from senzing_core import SzAbstractFactoryCore
99

1010
ENGINE_CONFIG_JSON = os.getenv("SENZING_ENGINE_CONFIGURATION_JSON", "{}")
1111
INSTANCE_NAME = Path(__file__).stem
@@ -24,7 +24,7 @@
2424
sys.exit()
2525

2626
try:
27-
sz_factory = SzAbstractFactory(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
27+
sz_factory = SzAbstractFactoryCore(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
2828
sz_diagnostic = sz_factory.create_diagnostic()
2929
sz_diagnostic.purge_repository()
3030
print("\nSenzing datastore purged")

python/loading/add_futures.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from pathlib import Path
99

1010
from senzing import SzBadInputError, SzError, SzRetryableError, SzUnrecoverableError
11-
from senzing_core import SzAbstractFactory
11+
from senzing_core import SzAbstractFactoryCore
1212

1313
ENGINE_CONFIG_JSON = os.getenv("SENZING_ENGINE_CONFIGURATION_JSON", "{}")
1414
INPUT_FILE = Path("../../resources/data/load-500.jsonl").resolve()
@@ -68,7 +68,7 @@ def futures_add(engine, input_file):
6868

6969

7070
try:
71-
sz_factory = SzAbstractFactory(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
71+
sz_factory = SzAbstractFactoryCore(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
7272
sz_engine = sz_factory.create_engine()
7373
futures_add(sz_engine, INPUT_FILE)
7474
except SzError as err:

python/loading/add_queue.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from pathlib import Path
99

1010
from senzing import SzBadInputError, SzError, SzRetryableError, SzUnrecoverableError
11-
from senzing_core import SzAbstractFactory
11+
from senzing_core import SzAbstractFactoryCore
1212

1313
ENGINE_CONFIG_JSON = os.getenv("SENZING_ENGINE_CONFIGURATION_JSON", "{}")
1414
INPUT_FILE = Path("../../resources/data/load-500.jsonl").resolve()
@@ -70,7 +70,7 @@ def consumer(engine, queue):
7070

7171

7272
try:
73-
sz_factory = SzAbstractFactory(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
73+
sz_factory = SzAbstractFactoryCore(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
7474
sz_engine = sz_factory.create_engine()
7575

7676
input_queue = Queue(maxsize=200) # type: ignore

python/loading/add_records.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from pathlib import Path
66

77
from senzing import SzError
8-
from senzing_core import SzAbstractFactory
8+
from senzing_core import SzAbstractFactoryCore
99

1010
ENGINE_CONFIG_JSON = os.getenv("SENZING_ENGINE_CONFIGURATION_JSON", "{}")
1111
INSTANCE_NAME = Path(__file__).stem
@@ -94,7 +94,7 @@
9494
]
9595

9696
try:
97-
sz_factory = SzAbstractFactory(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
97+
sz_factory = SzAbstractFactoryCore(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
9898
sz_engine = sz_factory.create_engine()
9999

100100
for record in RECORDS:

python/loading/add_records_loop.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pathlib import Path
77

88
from senzing import SzBadInputError, SzError, SzRetryableError, SzUnrecoverableError
9-
from senzing_core import SzAbstractFactory
9+
from senzing_core import SzAbstractFactoryCore
1010

1111
ENGINE_CONFIG_JSON = os.getenv("SENZING_ENGINE_CONFIGURATION_JSON", "{}")
1212
INPUT_FILE = Path("../../resources/data/load-500.jsonl").resolve()
@@ -49,7 +49,7 @@ def add_records_from_file(engine, input_file):
4949

5050

5151
try:
52-
sz_factory = SzAbstractFactory(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
52+
sz_factory = SzAbstractFactoryCore(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
5353
sz_engine = sz_factory.create_engine()
5454
add_records_from_file(sz_engine, INPUT_FILE)
5555
except SzError as err:

python/loading/add_truthset_loop.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pathlib import Path
77

88
from senzing import SzBadInputError, SzError, SzRetryableError, SzUnrecoverableError
9-
from senzing_core import SzAbstractFactory
9+
from senzing_core import SzAbstractFactoryCore
1010

1111
ENGINE_CONFIG_JSON = os.getenv("SENZING_ENGINE_CONFIGURATION_JSON", "{}")
1212
INPUT_FILES = [
@@ -55,7 +55,7 @@ def add_records_from_file(engine, input_file):
5555

5656

5757
try:
58-
sz_factory = SzAbstractFactory(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
58+
sz_factory = SzAbstractFactoryCore(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
5959
sz_engine = sz_factory.create_engine()
6060
for load_file in INPUT_FILES:
6161
add_records_from_file(sz_engine, load_file)

python/loading/add_with_info_futures.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
SzRetryableError,
1515
SzUnrecoverableError,
1616
)
17-
from senzing_core import SzAbstractFactory
17+
from senzing_core import SzAbstractFactoryCore
1818

1919
ENGINE_CONFIG_JSON = os.getenv("SENZING_ENGINE_CONFIGURATION_JSON", "{}")
2020
INPUT_FILE = Path("../../resources/data/load-500-with-errors.jsonl").resolve()
@@ -92,7 +92,7 @@ def futures_add(engine, input_file, output_file):
9292

9393

9494
try:
95-
sz_factory = SzAbstractFactory(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
95+
sz_factory = SzAbstractFactoryCore(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
9696
sz_engine = sz_factory.create_engine()
9797
futures_add(sz_engine, INPUT_FILE, OUTPUT_FILE)
9898
except SzError as err:

python/redo/add_with_redo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pathlib import Path
77

88
from senzing import SzBadInputError, SzError, SzRetryableError, SzUnrecoverableError
9-
from senzing_core import SzAbstractFactory
9+
from senzing_core import SzAbstractFactoryCore
1010

1111
ENGINE_CONFIG_JSON = os.getenv("SENZING_ENGINE_CONFIGURATION_JSON", "{}")
1212
INPUT_FILE = Path("../../resources/data/load-500.jsonl").resolve()
@@ -79,7 +79,7 @@ def process_redo(engine):
7979

8080

8181
try:
82-
sz_factory = SzAbstractFactory(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
82+
sz_factory = SzAbstractFactoryCore(INSTANCE_NAME, ENGINE_CONFIG_JSON, verbose_logging=False)
8383
sz_engine = sz_factory.create_engine()
8484
add_records_from_file(sz_engine, INPUT_FILE)
8585
redo_count = sz_engine.count_redo_records()

0 commit comments

Comments
 (0)