corva-worker-python 2.3.3__tar.gz → 2.3.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- corva_worker_python-2.3.6/.env.sample +19 -0
- corva_worker_python-2.3.6/.github/renovate.json +11 -0
- corva_worker_python-2.3.6/.github/workflows/code_coverage.py +79 -0
- corva_worker_python-2.3.6/.github/workflows/main.yml +84 -0
- corva_worker_python-2.3.6/.gitignore +109 -0
- corva_worker_python-2.3.6/Makefile +81 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/PKG-INFO +1 -1
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/README.md +4 -2
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/corva_worker_python.egg-info/PKG-INFO +1 -1
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/corva_worker_python.egg-info/SOURCES.txt +43 -0
- corva_worker_python-2.3.6/corva_worker_python.egg-info/scm_file_list.json +120 -0
- corva_worker_python-2.3.6/corva_worker_python.egg-info/scm_version.json +8 -0
- corva_worker_python-2.3.6/docs/ALERTS.md +31 -0
- corva_worker_python-2.3.6/docs/STATE_HANDLER.md +80 -0
- corva_worker_python-2.3.6/docs/TASK_HANDLER.md +180 -0
- corva_worker_python-2.3.6/docs/UNDER_REAMER.md +61 -0
- corva_worker_python-2.3.6/docs/figures/event_based_alert.png +0 -0
- corva_worker_python-2.3.6/docs/figures/task_handler.png +0 -0
- corva_worker_python-2.3.6/docs/figures/ur_flow_chart.png +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/pyproject.toml +4 -0
- corva_worker_python-2.3.6/requirements_extra.txt +7 -0
- corva_worker_python-2.3.6/resources/test/activity_grouping.data +1714 -0
- corva_worker_python-2.3.6/resources/test/casings.json +89 -0
- corva_worker_python-2.3.6/resources/test/drillstring.json +332 -0
- corva_worker_python-2.3.6/resources/test/events/scheduler.json +316 -0
- corva_worker_python-2.3.6/resources/test/events/wits_stream.json +900 -0
- corva_worker_python-2.3.6/resources/test/original_rollbar_payload.json +775 -0
- corva_worker_python-2.3.6/resources/test/serialized_wellbore.json +106 -0
- corva_worker_python-2.3.6/resources/test/wits.json +44 -0
- corva_worker_python-2.3.6/resources/test/wits_class/wits_sample1.json +63 -0
- corva_worker_python-2.3.6/resources/test/wits_class/wits_sample2.json +71 -0
- corva_worker_python-2.3.6/resources/test/wits_riserless.json +44 -0
- corva_worker_python-2.3.6/resources/test/wits_under_reamer.json +44 -0
- corva_worker_python-2.3.6/resources/test/wits_under_reamer_below_shoe.json +516 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/setup.py +1 -1
- corva_worker_python-2.3.6/testcase/run_lambda_app.py +31 -0
- corva_worker_python-2.3.6/testcase/run_local_testing.py +97 -0
- corva_worker_python-2.3.6/testcase/test_activity.py +149 -0
- corva_worker_python-2.3.6/testcase/test_api.py +36 -0
- corva_worker_python-2.3.6/testcase/test_build_empty_output.py +100 -0
- corva_worker_python-2.3.6/testcase/test_events.py +66 -0
- corva_worker_python-2.3.6/testcase/test_lambda_app.py +56 -0
- corva_worker_python-2.3.6/testcase/test_rollbar_payload_handler.py +22 -0
- corva_worker_python-2.3.6/testcase/test_state_mixin.py +23 -0
- corva_worker_python-2.3.6/testcase/test_utils.py +112 -0
- corva_worker_python-2.3.6/testcase/test_wellbore.py +1232 -0
- corva_worker_python-2.3.6/testcase/test_wits.py +144 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/data/api.py +9 -2
- corva_worker_python-2.3.6/worker/test/local_testing/README.md +28 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/wellbore/factory.py +10 -8
- corva_worker_python-2.3.6/worker/wellbore/model/__init__.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/wellbore/wellbore.py +7 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/corva_worker_python.egg-info/dependency_links.txt +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/corva_worker_python.egg-info/requires.txt +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/corva_worker_python.egg-info/top_level.txt +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/setup.cfg +0 -0
- {corva_worker_python-2.3.3/worker/data → corva_worker_python-2.3.6/testcase}/__init__.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/testcase/app/__init__.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/testcase/app/app_constants.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/testcase/app/app_lambda.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/testcase/app/app_partial_rerun_merger.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/testcase/app/disable_module.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/testcase/app/drilling_efficiency_app.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/testcase/app/surface_mse_module.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/testcase/state_testing_app/__init__.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/testcase/state_testing_app/app_constants.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/testcase/state_testing_app/app_lambda.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/testcase/state_testing_app/state_modules.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/testcase/state_testing_app/state_testing_app.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/__init__.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/app/__init__.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/app/modules/__init__.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/app/modules/activity_module.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/app/modules/connection_module.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/app/modules/depth_activity_module.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/app/modules/scheduler.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/app/modules/time_activity_module.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/app/modules/trigger.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/constants.py +0 -0
- {corva_worker_python-2.3.3/worker/mixins → corva_worker_python-2.3.6/worker/data}/__init__.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/data/activity/__init__.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/data/activity/activity_grouping.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/data/alert.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/data/enums.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/data/json_encoder.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/data/math.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/data/operations.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/data/serialization.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/data/task_handler.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/data/two_way_dict.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/data/unit_conversions.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/data/wits.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/event/__init__.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/event/event_handler.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/event/scheduled.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/event/stream.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/exceptions.py +0 -0
- {corva_worker_python-2.3.3/worker/partial_rerun_merge → corva_worker_python-2.3.6/worker/mixins}/__init__.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/mixins/logging.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/mixins/rollbar.py +0 -0
- {corva_worker_python-2.3.3/worker/test/local_testing → corva_worker_python-2.3.6/worker/partial_rerun_merge}/__init__.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/partial_rerun_merge/merge.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/partial_rerun_merge/models.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/partial_rerun_merge/progress.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/state/__init__.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/state/mixins.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/state/state.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/test/__init__.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/test/lambda_function_test_run.py +0 -0
- {corva_worker_python-2.3.3/worker/wellbore → corva_worker_python-2.3.6/worker/test/local_testing}/__init__.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/test/local_testing/to_local_transfer.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/test/utils.py +0 -0
- {corva_worker_python-2.3.3/worker/wellbore/model → corva_worker_python-2.3.6/worker/wellbore}/__init__.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/wellbore/measured_depth_finder.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/wellbore/model/ann.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/wellbore/model/annulus.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/wellbore/model/drillstring.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/wellbore/model/drillstring_components.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/wellbore/model/element.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/wellbore/model/enums.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/wellbore/model/hole.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/wellbore/model/hole_section.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/wellbore/model/riser.py +0 -0
- {corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/worker/wellbore/sections_mixin.py +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
API_KEY_qa=?
|
|
2
|
+
API_KEY_staging=?
|
|
3
|
+
API_KEY_production=?
|
|
4
|
+
API_KEY_local=?
|
|
5
|
+
|
|
6
|
+
API_ROOT_URL_qa=https://api.qa.corva.ai
|
|
7
|
+
API_ROOT_URL_staging=https://api.staging.corva.ai
|
|
8
|
+
API_ROOT_URL_production=https://api.corva.ai
|
|
9
|
+
API_ROOT_URL_local=http://localhost
|
|
10
|
+
|
|
11
|
+
CACHE_URL_local=redis://localhost:6379
|
|
12
|
+
|
|
13
|
+
APP_NAME=Local_Computer
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
LOGGING_LEVEL=debug
|
|
17
|
+
LOGGING_ASSET_ID=all
|
|
18
|
+
STATE_STORAGE_CRITICAL_LIMIT=10000
|
|
19
|
+
STATE_STORAGE_WARNING_LIMIT=3000
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
3
|
+
"extends": [
|
|
4
|
+
"github>corva-ai/corva-renovate//presets/schedule",
|
|
5
|
+
"github>corva-ai/corva-renovate//presets/settings",
|
|
6
|
+
"github>corva-ai/corva-renovate//presets/labels",
|
|
7
|
+
"github>corva-ai/corva-renovate//presets/github-actions",
|
|
8
|
+
"github>corva-ai/corva-renovate//presets/python"
|
|
9
|
+
],
|
|
10
|
+
"dependencyDashboardApproval": true
|
|
11
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
import time
|
|
5
|
+
|
|
6
|
+
import coverage
|
|
7
|
+
import requests
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def get_total() -> float:
|
|
11
|
+
"""Extracts the coverage report from .coverage file"""
|
|
12
|
+
|
|
13
|
+
cov = coverage.Coverage()
|
|
14
|
+
cov.load()
|
|
15
|
+
coverage_percentage = cov.report(file=open(os.devnull, "w"))
|
|
16
|
+
|
|
17
|
+
return round(coverage_percentage, 2)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def store_coverage(coverage_percentage: float):
|
|
21
|
+
"""
|
|
22
|
+
Stores the coverage percentage to a dataset with relevant context
|
|
23
|
+
:param coverage_percentage: Total code coverage percentage
|
|
24
|
+
:return:
|
|
25
|
+
"""
|
|
26
|
+
company_id = 80
|
|
27
|
+
provider = "big-data-energy"
|
|
28
|
+
collection = "code-coverage"
|
|
29
|
+
|
|
30
|
+
repo_name = os.getenv("GITHUB_REPOSITORY", "corva-ai/test-repository.git").lstrip("corva-ai/").rstrip(".git")
|
|
31
|
+
sha = os.getenv("GITHUB_SHA", "abc123")
|
|
32
|
+
developer = os.getenv("GITHUB_ACTOR", "---")
|
|
33
|
+
branch = os.getenv("GITHUB_REF_NAME", "---")
|
|
34
|
+
|
|
35
|
+
output = [
|
|
36
|
+
{
|
|
37
|
+
"timestamp": int(time.time()),
|
|
38
|
+
"company_id": company_id,
|
|
39
|
+
"version": 1,
|
|
40
|
+
"provider": provider,
|
|
41
|
+
"collection": collection,
|
|
42
|
+
"data": {
|
|
43
|
+
"repository": repo_name,
|
|
44
|
+
"commit_sha": sha,
|
|
45
|
+
"coverage": coverage_percentage,
|
|
46
|
+
"developer": developer,
|
|
47
|
+
"branch": branch,
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
# Store coverage to an external dataset here
|
|
53
|
+
response = requests.post(
|
|
54
|
+
url=f"https://data.qa.corva.ai/api/v1/data/{provider}/{collection}/",
|
|
55
|
+
data=json.dumps(output),
|
|
56
|
+
headers={
|
|
57
|
+
"Authorization": f"API {os.getenv('API_KEY')}",
|
|
58
|
+
"Content-Type": "application/json",
|
|
59
|
+
"X-Corva-App": "github-store-test-cov",
|
|
60
|
+
},
|
|
61
|
+
)
|
|
62
|
+
print(f"response = {response.json()}")
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def main():
|
|
66
|
+
"""
|
|
67
|
+
The main function to run the code
|
|
68
|
+
"""
|
|
69
|
+
try:
|
|
70
|
+
coverage_percentage = get_total()
|
|
71
|
+
except coverage.misc.CoverageException as exception:
|
|
72
|
+
print(f"Error: {exception} Did you run coverage first?")
|
|
73
|
+
sys.exit(1)
|
|
74
|
+
|
|
75
|
+
store_coverage(coverage_percentage)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
if __name__ == "__main__":
|
|
79
|
+
main()
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on: push
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
static:
|
|
7
|
+
name: Static Analysis
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
strategy:
|
|
10
|
+
matrix:
|
|
11
|
+
python-version: ['3.13', '3.14']
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v5
|
|
15
|
+
with:
|
|
16
|
+
fetch-depth: 0
|
|
17
|
+
|
|
18
|
+
- uses: actions/setup-python@v6
|
|
19
|
+
with:
|
|
20
|
+
python-version: ${{ matrix.python-version }}
|
|
21
|
+
|
|
22
|
+
- name: Install Lint Dependencies
|
|
23
|
+
run: make install-extra
|
|
24
|
+
|
|
25
|
+
- name: Run
|
|
26
|
+
run: make lint
|
|
27
|
+
|
|
28
|
+
test:
|
|
29
|
+
name: Automated Testing
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
strategy:
|
|
32
|
+
max-parallel: 1 # avoid running tests in parallel because of shared resources
|
|
33
|
+
matrix:
|
|
34
|
+
python-version: ['3.13', '3.14']
|
|
35
|
+
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/checkout@v5
|
|
38
|
+
with:
|
|
39
|
+
fetch-depth: 0
|
|
40
|
+
|
|
41
|
+
- uses: actions/setup-python@v6
|
|
42
|
+
with:
|
|
43
|
+
python-version: ${{ matrix.python-version }}
|
|
44
|
+
|
|
45
|
+
- name: Install Dependencies
|
|
46
|
+
run: make install
|
|
47
|
+
|
|
48
|
+
- name: Run Tests and Coverage
|
|
49
|
+
run: |
|
|
50
|
+
make test
|
|
51
|
+
make store-test-coverage
|
|
52
|
+
env:
|
|
53
|
+
API_KEY: ${{ secrets.API_KEY_qa }}
|
|
54
|
+
API_ROOT_URL: ${{ secrets.API_ROOT_URL_qa }}
|
|
55
|
+
ENVIRONMENT: ${{ secrets.ENVIRONMENT }}
|
|
56
|
+
APP_NAME: ${{ secrets.APP_NAME }}
|
|
57
|
+
CACHE_URL: ${{ secrets.CACHE_URL_qa }}
|
|
58
|
+
|
|
59
|
+
deploy:
|
|
60
|
+
name: Build and Publishing to PyPI
|
|
61
|
+
needs: [ static, test ]
|
|
62
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
63
|
+
runs-on: ubuntu-latest
|
|
64
|
+
permissions:
|
|
65
|
+
contents: read
|
|
66
|
+
id-token: write
|
|
67
|
+
steps:
|
|
68
|
+
- uses: actions/checkout@v5
|
|
69
|
+
with:
|
|
70
|
+
fetch-depth: 0
|
|
71
|
+
|
|
72
|
+
- name: Set up Python
|
|
73
|
+
uses: actions/setup-python@v6
|
|
74
|
+
with:
|
|
75
|
+
python-version: 3.13
|
|
76
|
+
|
|
77
|
+
- name: Install Dependencies
|
|
78
|
+
run: pip install build
|
|
79
|
+
|
|
80
|
+
- name: Build the Package
|
|
81
|
+
run: python -m build
|
|
82
|
+
|
|
83
|
+
- name: Publishing to PyPI
|
|
84
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Created by .ignore support plugin (hsz.mobi)
|
|
2
|
+
### Python template
|
|
3
|
+
# Byte-compiled / optimized / DLL files
|
|
4
|
+
__pycache__/
|
|
5
|
+
*.py[cod]
|
|
6
|
+
*$py.class
|
|
7
|
+
|
|
8
|
+
# C extensions
|
|
9
|
+
*.so
|
|
10
|
+
|
|
11
|
+
# Distribution / packaging
|
|
12
|
+
.Python
|
|
13
|
+
build/
|
|
14
|
+
develop-eggs/
|
|
15
|
+
dist/
|
|
16
|
+
downloads/
|
|
17
|
+
eggs/
|
|
18
|
+
.eggs/
|
|
19
|
+
lib/
|
|
20
|
+
lib64/
|
|
21
|
+
parts/
|
|
22
|
+
sdist/
|
|
23
|
+
var/
|
|
24
|
+
wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
.hypothesis/
|
|
50
|
+
.pytest_cache/
|
|
51
|
+
|
|
52
|
+
# Translations
|
|
53
|
+
*.mo
|
|
54
|
+
*.pot
|
|
55
|
+
|
|
56
|
+
# Django stuff:
|
|
57
|
+
*.log
|
|
58
|
+
local_settings.py
|
|
59
|
+
db.sqlite3
|
|
60
|
+
|
|
61
|
+
# Flask stuff:
|
|
62
|
+
instance/
|
|
63
|
+
.webassets-cache
|
|
64
|
+
|
|
65
|
+
# Scrapy stuff:
|
|
66
|
+
.scrapy
|
|
67
|
+
|
|
68
|
+
# Sphinx documentation
|
|
69
|
+
docs/_build/
|
|
70
|
+
|
|
71
|
+
# PyBuilder
|
|
72
|
+
target/
|
|
73
|
+
|
|
74
|
+
# Jupyter Notebook
|
|
75
|
+
.ipynb_checkpoints
|
|
76
|
+
|
|
77
|
+
# pyenv
|
|
78
|
+
.python-version
|
|
79
|
+
|
|
80
|
+
# celery beat schedule file
|
|
81
|
+
celerybeat-schedule
|
|
82
|
+
|
|
83
|
+
# SageMath parsed files
|
|
84
|
+
*.sage.py
|
|
85
|
+
|
|
86
|
+
# Environments
|
|
87
|
+
.env
|
|
88
|
+
.venv
|
|
89
|
+
env/
|
|
90
|
+
venv/
|
|
91
|
+
ENV/
|
|
92
|
+
env.bak/
|
|
93
|
+
venv.bak/
|
|
94
|
+
|
|
95
|
+
# Spyder project settings
|
|
96
|
+
.spyderproject
|
|
97
|
+
.spyproject
|
|
98
|
+
|
|
99
|
+
# Rope project settings
|
|
100
|
+
.ropeproject
|
|
101
|
+
|
|
102
|
+
# mkdocs documentation
|
|
103
|
+
/site
|
|
104
|
+
|
|
105
|
+
# mypy
|
|
106
|
+
.mypy_cache/
|
|
107
|
+
|
|
108
|
+
.idea/
|
|
109
|
+
.vscode/
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
CACHE_PORT ?= 6379
|
|
2
|
+
CACHE_URL ?= redis://localhost:$(CACHE_PORT)
|
|
3
|
+
API_KEY ?=
|
|
4
|
+
API_ROOT_URL ?=
|
|
5
|
+
APP_NAME ?=
|
|
6
|
+
export
|
|
7
|
+
|
|
8
|
+
run_redis = docker run --rm -d --name worker-redis -p $(CACHE_PORT):$(CACHE_PORT) redis:7.4-alpine
|
|
9
|
+
stop_redis = docker stop worker-redis
|
|
10
|
+
|
|
11
|
+
srcs = worker testcase
|
|
12
|
+
isort = isort $(srcs)
|
|
13
|
+
black = black $(srcs)
|
|
14
|
+
|
|
15
|
+
## help: Show this help.
|
|
16
|
+
.PHONY: help
|
|
17
|
+
help: Makefile
|
|
18
|
+
@sed -n 's/^##\s//p' $<
|
|
19
|
+
|
|
20
|
+
## install: Install all requirements.
|
|
21
|
+
.PHONY: install
|
|
22
|
+
install: install-worker install-extra
|
|
23
|
+
|
|
24
|
+
## install-worker: Install worker requirements.
|
|
25
|
+
.PHONY: install-worker
|
|
26
|
+
install-worker:
|
|
27
|
+
@pip install -e .
|
|
28
|
+
|
|
29
|
+
## install-extra: Install extra requirements.
|
|
30
|
+
.PHONY: install-extra
|
|
31
|
+
install-extra:
|
|
32
|
+
@pip install --upgrade -r requirements_extra.txt
|
|
33
|
+
|
|
34
|
+
## test: Run tests and show code coverage.
|
|
35
|
+
.PHONY: test
|
|
36
|
+
test: test-worker test-lambda-app
|
|
37
|
+
@coverage report
|
|
38
|
+
|
|
39
|
+
## test-worker: Run worker tests.
|
|
40
|
+
.PHONY: test-worker
|
|
41
|
+
test-worker:
|
|
42
|
+
@$(run_redis)
|
|
43
|
+
@coverage run --branch --source=worker/ -m unittest -v
|
|
44
|
+
@$(stop_redis)
|
|
45
|
+
|
|
46
|
+
## test-lambda-app: Run specific lambda app test.
|
|
47
|
+
.PHONY: test-lambda-app
|
|
48
|
+
test-lambda-app:
|
|
49
|
+
@$(run_redis)
|
|
50
|
+
@python testcase/run_lambda_app.py -a 3083 -s 1502041854 -e 1502043349 -i 600 -d true
|
|
51
|
+
@$(stop_redis)
|
|
52
|
+
|
|
53
|
+
## store-test-coverage: Run tests and store coverage.
|
|
54
|
+
.PHONY: store-test-coverage
|
|
55
|
+
store-test-coverage:
|
|
56
|
+
@-python3 .github/workflows/code_coverage.py
|
|
57
|
+
|
|
58
|
+
## lint: Run linter.
|
|
59
|
+
.PHONY: lint
|
|
60
|
+
lint:
|
|
61
|
+
@flake8 $(srcs)
|
|
62
|
+
@$(isort) --check
|
|
63
|
+
@$(black) --check
|
|
64
|
+
|
|
65
|
+
## format: Format all files.
|
|
66
|
+
.PHONY: format
|
|
67
|
+
format:
|
|
68
|
+
@$(black)
|
|
69
|
+
@$(isort)
|
|
70
|
+
|
|
71
|
+
## clean: Clean autogenerated files.
|
|
72
|
+
.PHONY: clean
|
|
73
|
+
clean:
|
|
74
|
+
@-python3 -Bc "for p in __import__('pathlib').Path('.').rglob('*.py[co]'): p.unlink()"
|
|
75
|
+
@-python3 -Bc "for p in __import__('pathlib').Path('.').rglob('__pycache__'): p.rmdir()"
|
|
76
|
+
@-rm -rf *.egg-info
|
|
77
|
+
@-rm -rf .pytest_cache
|
|
78
|
+
@-rm -rf htmlcov
|
|
79
|
+
@-rm -rf .coverage
|
|
80
|
+
@-rm -rf build
|
|
81
|
+
@-rm -rf dist
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: corva-worker-python
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.6
|
|
4
4
|
Summary: SDK for interacting with Corva
|
|
5
5
|
Home-page: https://github.com/corva-ai/corva-worker-python
|
|
6
6
|
Author: Jordan Ambra <jordan.ambra@corva.ai>, Mohammadreza Kamyab <m.kamyab@corva.ai>
|
|
@@ -8,8 +8,10 @@ A repository for integrated python data app development.
|
|
|
8
8
|
|
|
9
9
|
Follow these steps to publish the distribution to PYPI:
|
|
10
10
|
1. Check out "master" branch
|
|
11
|
-
2.
|
|
12
|
-
3. Go to the [Release Page](https://github.com/corva-ai/corva-worker-python/releases/),
|
|
11
|
+
2. Ensure the release changes are committed and pushed.
|
|
12
|
+
3. Go to the [Release Page](https://github.com/corva-ai/corva-worker-python/releases/), then create a new tag (for example, `v2.3.5`) on the release commit and publish the release.
|
|
13
|
+
|
|
14
|
+
The package version is derived automatically from Git tags using `setuptools-scm`: `v2.3.5` builds version `2.3.5`. There is no version to update in `setup.py`. Builds between tags receive development versions. Build from a Git checkout with full history and tags, or from a generated source distribution.
|
|
13
15
|
|
|
14
16
|
## Included Modules
|
|
15
17
|
### API
|
{corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/corva_worker_python.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: corva-worker-python
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.6
|
|
4
4
|
Summary: SDK for interacting with Corva
|
|
5
5
|
Home-page: https://github.com/corva-ai/corva-worker-python
|
|
6
6
|
Author: Jordan Ambra <jordan.ambra@corva.ai>, Mohammadreza Kamyab <m.kamyab@corva.ai>
|
{corva_worker_python-2.3.3 → corva_worker_python-2.3.6}/corva_worker_python.egg-info/SOURCES.txt
RENAMED
|
@@ -1,12 +1,54 @@
|
|
|
1
|
+
.env.sample
|
|
2
|
+
.gitignore
|
|
3
|
+
Makefile
|
|
1
4
|
README.md
|
|
2
5
|
pyproject.toml
|
|
6
|
+
requirements_extra.txt
|
|
3
7
|
setup.cfg
|
|
4
8
|
setup.py
|
|
9
|
+
.github/renovate.json
|
|
10
|
+
.github/workflows/code_coverage.py
|
|
11
|
+
.github/workflows/main.yml
|
|
5
12
|
corva_worker_python.egg-info/PKG-INFO
|
|
6
13
|
corva_worker_python.egg-info/SOURCES.txt
|
|
7
14
|
corva_worker_python.egg-info/dependency_links.txt
|
|
8
15
|
corva_worker_python.egg-info/requires.txt
|
|
16
|
+
corva_worker_python.egg-info/scm_file_list.json
|
|
17
|
+
corva_worker_python.egg-info/scm_version.json
|
|
9
18
|
corva_worker_python.egg-info/top_level.txt
|
|
19
|
+
docs/ALERTS.md
|
|
20
|
+
docs/STATE_HANDLER.md
|
|
21
|
+
docs/TASK_HANDLER.md
|
|
22
|
+
docs/UNDER_REAMER.md
|
|
23
|
+
docs/figures/event_based_alert.png
|
|
24
|
+
docs/figures/task_handler.png
|
|
25
|
+
docs/figures/ur_flow_chart.png
|
|
26
|
+
resources/test/activity_grouping.data
|
|
27
|
+
resources/test/casings.json
|
|
28
|
+
resources/test/drillstring.json
|
|
29
|
+
resources/test/original_rollbar_payload.json
|
|
30
|
+
resources/test/serialized_wellbore.json
|
|
31
|
+
resources/test/wits.json
|
|
32
|
+
resources/test/wits_riserless.json
|
|
33
|
+
resources/test/wits_under_reamer.json
|
|
34
|
+
resources/test/wits_under_reamer_below_shoe.json
|
|
35
|
+
resources/test/events/scheduler.json
|
|
36
|
+
resources/test/events/wits_stream.json
|
|
37
|
+
resources/test/wits_class/wits_sample1.json
|
|
38
|
+
resources/test/wits_class/wits_sample2.json
|
|
39
|
+
testcase/__init__.py
|
|
40
|
+
testcase/run_lambda_app.py
|
|
41
|
+
testcase/run_local_testing.py
|
|
42
|
+
testcase/test_activity.py
|
|
43
|
+
testcase/test_api.py
|
|
44
|
+
testcase/test_build_empty_output.py
|
|
45
|
+
testcase/test_events.py
|
|
46
|
+
testcase/test_lambda_app.py
|
|
47
|
+
testcase/test_rollbar_payload_handler.py
|
|
48
|
+
testcase/test_state_mixin.py
|
|
49
|
+
testcase/test_utils.py
|
|
50
|
+
testcase/test_wellbore.py
|
|
51
|
+
testcase/test_wits.py
|
|
10
52
|
testcase/app/__init__.py
|
|
11
53
|
testcase/app/app_constants.py
|
|
12
54
|
testcase/app/app_lambda.py
|
|
@@ -61,6 +103,7 @@ worker/state/state.py
|
|
|
61
103
|
worker/test/__init__.py
|
|
62
104
|
worker/test/lambda_function_test_run.py
|
|
63
105
|
worker/test/utils.py
|
|
106
|
+
worker/test/local_testing/README.md
|
|
64
107
|
worker/test/local_testing/__init__.py
|
|
65
108
|
worker/test/local_testing/to_local_transfer.py
|
|
66
109
|
worker/wellbore/__init__.py
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": [
|
|
3
|
+
".env.sample",
|
|
4
|
+
".github/renovate.json",
|
|
5
|
+
".github/workflows/code_coverage.py",
|
|
6
|
+
".github/workflows/main.yml",
|
|
7
|
+
".gitignore",
|
|
8
|
+
"Makefile",
|
|
9
|
+
"README.md",
|
|
10
|
+
"docs/ALERTS.md",
|
|
11
|
+
"docs/STATE_HANDLER.md",
|
|
12
|
+
"docs/TASK_HANDLER.md",
|
|
13
|
+
"docs/UNDER_REAMER.md",
|
|
14
|
+
"docs/figures/event_based_alert.png",
|
|
15
|
+
"docs/figures/task_handler.png",
|
|
16
|
+
"docs/figures/ur_flow_chart.png",
|
|
17
|
+
"pyproject.toml",
|
|
18
|
+
"requirements_extra.txt",
|
|
19
|
+
"resources/test/activity_grouping.data",
|
|
20
|
+
"resources/test/casings.json",
|
|
21
|
+
"resources/test/drillstring.json",
|
|
22
|
+
"resources/test/events/scheduler.json",
|
|
23
|
+
"resources/test/events/wits_stream.json",
|
|
24
|
+
"resources/test/original_rollbar_payload.json",
|
|
25
|
+
"resources/test/serialized_wellbore.json",
|
|
26
|
+
"resources/test/wits.json",
|
|
27
|
+
"resources/test/wits_class/wits_sample1.json",
|
|
28
|
+
"resources/test/wits_class/wits_sample2.json",
|
|
29
|
+
"resources/test/wits_riserless.json",
|
|
30
|
+
"resources/test/wits_under_reamer.json",
|
|
31
|
+
"resources/test/wits_under_reamer_below_shoe.json",
|
|
32
|
+
"setup.cfg",
|
|
33
|
+
"setup.py",
|
|
34
|
+
"testcase/__init__.py",
|
|
35
|
+
"testcase/app/__init__.py",
|
|
36
|
+
"testcase/app/app_constants.py",
|
|
37
|
+
"testcase/app/app_lambda.py",
|
|
38
|
+
"testcase/app/app_partial_rerun_merger.py",
|
|
39
|
+
"testcase/app/disable_module.py",
|
|
40
|
+
"testcase/app/drilling_efficiency_app.py",
|
|
41
|
+
"testcase/app/surface_mse_module.py",
|
|
42
|
+
"testcase/run_lambda_app.py",
|
|
43
|
+
"testcase/run_local_testing.py",
|
|
44
|
+
"testcase/state_testing_app/__init__.py",
|
|
45
|
+
"testcase/state_testing_app/app_constants.py",
|
|
46
|
+
"testcase/state_testing_app/app_lambda.py",
|
|
47
|
+
"testcase/state_testing_app/state_modules.py",
|
|
48
|
+
"testcase/state_testing_app/state_testing_app.py",
|
|
49
|
+
"testcase/test_activity.py",
|
|
50
|
+
"testcase/test_api.py",
|
|
51
|
+
"testcase/test_build_empty_output.py",
|
|
52
|
+
"testcase/test_events.py",
|
|
53
|
+
"testcase/test_lambda_app.py",
|
|
54
|
+
"testcase/test_rollbar_payload_handler.py",
|
|
55
|
+
"testcase/test_state_mixin.py",
|
|
56
|
+
"testcase/test_utils.py",
|
|
57
|
+
"testcase/test_wellbore.py",
|
|
58
|
+
"testcase/test_wits.py",
|
|
59
|
+
"worker/__init__.py",
|
|
60
|
+
"worker/app/__init__.py",
|
|
61
|
+
"worker/app/modules/__init__.py",
|
|
62
|
+
"worker/app/modules/activity_module.py",
|
|
63
|
+
"worker/app/modules/connection_module.py",
|
|
64
|
+
"worker/app/modules/depth_activity_module.py",
|
|
65
|
+
"worker/app/modules/scheduler.py",
|
|
66
|
+
"worker/app/modules/time_activity_module.py",
|
|
67
|
+
"worker/app/modules/trigger.py",
|
|
68
|
+
"worker/constants.py",
|
|
69
|
+
"worker/data/__init__.py",
|
|
70
|
+
"worker/data/activity/__init__.py",
|
|
71
|
+
"worker/data/activity/activity_grouping.py",
|
|
72
|
+
"worker/data/alert.py",
|
|
73
|
+
"worker/data/api.py",
|
|
74
|
+
"worker/data/enums.py",
|
|
75
|
+
"worker/data/json_encoder.py",
|
|
76
|
+
"worker/data/math.py",
|
|
77
|
+
"worker/data/operations.py",
|
|
78
|
+
"worker/data/serialization.py",
|
|
79
|
+
"worker/data/task_handler.py",
|
|
80
|
+
"worker/data/two_way_dict.py",
|
|
81
|
+
"worker/data/unit_conversions.py",
|
|
82
|
+
"worker/data/wits.py",
|
|
83
|
+
"worker/event/__init__.py",
|
|
84
|
+
"worker/event/event_handler.py",
|
|
85
|
+
"worker/event/scheduled.py",
|
|
86
|
+
"worker/event/stream.py",
|
|
87
|
+
"worker/exceptions.py",
|
|
88
|
+
"worker/mixins/__init__.py",
|
|
89
|
+
"worker/mixins/logging.py",
|
|
90
|
+
"worker/mixins/rollbar.py",
|
|
91
|
+
"worker/partial_rerun_merge/__init__.py",
|
|
92
|
+
"worker/partial_rerun_merge/merge.py",
|
|
93
|
+
"worker/partial_rerun_merge/models.py",
|
|
94
|
+
"worker/partial_rerun_merge/progress.py",
|
|
95
|
+
"worker/state/__init__.py",
|
|
96
|
+
"worker/state/mixins.py",
|
|
97
|
+
"worker/state/state.py",
|
|
98
|
+
"worker/test/__init__.py",
|
|
99
|
+
"worker/test/lambda_function_test_run.py",
|
|
100
|
+
"worker/test/local_testing/README.md",
|
|
101
|
+
"worker/test/local_testing/__init__.py",
|
|
102
|
+
"worker/test/local_testing/to_local_transfer.py",
|
|
103
|
+
"worker/test/utils.py",
|
|
104
|
+
"worker/wellbore/__init__.py",
|
|
105
|
+
"worker/wellbore/factory.py",
|
|
106
|
+
"worker/wellbore/measured_depth_finder.py",
|
|
107
|
+
"worker/wellbore/model/__init__.py",
|
|
108
|
+
"worker/wellbore/model/ann.py",
|
|
109
|
+
"worker/wellbore/model/annulus.py",
|
|
110
|
+
"worker/wellbore/model/drillstring.py",
|
|
111
|
+
"worker/wellbore/model/drillstring_components.py",
|
|
112
|
+
"worker/wellbore/model/element.py",
|
|
113
|
+
"worker/wellbore/model/enums.py",
|
|
114
|
+
"worker/wellbore/model/hole.py",
|
|
115
|
+
"worker/wellbore/model/hole_section.py",
|
|
116
|
+
"worker/wellbore/model/riser.py",
|
|
117
|
+
"worker/wellbore/sections_mixin.py",
|
|
118
|
+
"worker/wellbore/wellbore.py"
|
|
119
|
+
]
|
|
120
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Alerts
|
|
2
|
+
|
|
3
|
+
Alert class can be used to trigger event based alerts from a data app.
|
|
4
|
+
|
|
5
|
+
## How to use:
|
|
6
|
+
1. An event based alert has to be created on the Corva UI with a unique identifier.
|
|
7
|
+

|
|
8
|
+
*Figure: Corva Alerts UI showing an event based alert with a unique identifier.*
|
|
9
|
+
|
|
10
|
+
2. Create an instance of Alert with the same unique identifier. Also pass in the asset id from wits data.
|
|
11
|
+
```python
|
|
12
|
+
from worker.data.alert import Alert
|
|
13
|
+
|
|
14
|
+
# input params
|
|
15
|
+
asset_id = 1234
|
|
16
|
+
alert_unique_identifier = 'alert_documentation_test'
|
|
17
|
+
|
|
18
|
+
# creating the instance of Alert for asset 1234 and unique id "alert_documentation"
|
|
19
|
+
test_alert = Alert(asset_id, alert_unique_identifier)
|
|
20
|
+
```
|
|
21
|
+
3. Call trigger_alert and pass the required parameters to trigger the alert.
|
|
22
|
+
```python
|
|
23
|
+
timestamp = 1600835716
|
|
24
|
+
timestamp_read = 1600835718
|
|
25
|
+
context = {"foo": 1, "bar": 2}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# triggering the alert
|
|
29
|
+
test_alert.trigger_alert(timestamp, timestamp_read, context)
|
|
30
|
+
```
|
|
31
|
+
4. To trigger an alert on Corva, the well must be active and visible to the user. (Current rules)
|