Skip to content
This repository was archived by the owner on Mar 13, 2020. It is now read-only.

Commit 3a83e6a

Browse files
authored
Merge pull request #19 from PageUpPeopleOrg/feature/OSC-1290_rename_mcd_to_dpo
OSC-1290 Rename to Data Pipeline Orchestrator / DPO
2 parents 75f4e40 + cdc104d commit 3a83e6a

21 files changed

+72
-66
lines changed

README.md

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# Model Change Detector
1+
# Data Pipeline Orchestrator
22

3-
[![Build Status](https://travis-ci.com/PageUpPeopleOrg/model-change-detector.svg?branch=master)](https://travis-ci.com/PageUpPeopleOrg/model-change-detector)
3+
[![Build Status](https://travis-ci.com/PageUpPeopleOrg/data-pipeline-orchestrator.svg?branch=master)](https://travis-ci.com/PageUpPeopleOrg/data-pipeline-orchestrator)
44

55
A utility that persists state of a data pipeline execution and uses them to detect changes in models.
66

77
## Usage
88

99
```
10-
$ python -m mcd [options] {db-connection-string} <command> [command-parameters]
10+
$ python -m dpo [options] {db-connection-string} <command> [command-parameters]
1111
```
1212

1313
- `options` include:
@@ -34,8 +34,8 @@ $ python -m mcd [options] {db-connection-string} <command> [command-parameters]
3434
To get help, use:
3535

3636
```
37-
$ python -m mcd --help
38-
$ python -m mcd <command> --help
37+
$ python -m dpo --help
38+
$ python -m dpo <command> --help
3939
```
4040

4141
### Usage Example
@@ -44,18 +44,18 @@ $ python -m mcd <command> --help
4444
$ pipenv install
4545
$ pipenv shell
4646
47-
$ python -m mcd postgresql+psycopg2://user:password@host:port/dbname init-execution
47+
$ python -m dpo postgresql+psycopg2://user:password@host:port/dbname init-execution
4848
49-
$ python -m mcd postgresql+psycopg2://user:password@host:port/dbname get-last-successful-execution
50-
$ python -m mcd postgresql+psycopg2://user:password@host:port/dbname get-execution-last-updated-timestamp id-as-returned-by-get-last-successful-execution-command
49+
$ python -m dpo postgresql+psycopg2://user:password@host:port/dbname get-last-successful-execution
50+
$ python -m dpo postgresql+psycopg2://user:password@host:port/dbname get-execution-last-updated-timestamp id-as-returned-by-get-last-successful-execution-command
5151
52-
$ python -m mcd postgresql+psycopg2://user:password@host:port/dbname persist-models id-as-retured-by-init-command load ./relative/path/to/load/models **/*.json
53-
$ python -m mcd postgresql+psycopg2://user:password@host:port/dbname compare-models id-as-retured-by-get-last-successful-execution-command id-as-retured-by-init-command load
52+
$ python -m dpo postgresql+psycopg2://user:password@host:port/dbname persist-models id-as-retured-by-init-command load ./relative/path/to/load/models **/*.json
53+
$ python -m dpo postgresql+psycopg2://user:password@host:port/dbname compare-models id-as-retured-by-get-last-successful-execution-command id-as-retured-by-init-command load
5454
55-
$ python -m mcd postgresql+psycopg2://user:password@host:port/dbname persist-models id-as-retured-by-init-command transform C:/absolute/path/to/transform/models group1/*.csv ./group2/**/*.sql
56-
$ python -m mcd postgresql+psycopg2://user:password@host:port/dbname compare-models id-as-retured-by-get-last-successful-execution-command id-as-retured-by-init-command transform
55+
$ python -m dpo postgresql+psycopg2://user:password@host:port/dbname persist-models id-as-retured-by-init-command transform C:/absolute/path/to/transform/models group1/*.csv ./group2/**/*.sql
56+
$ python -m dpo postgresql+psycopg2://user:password@host:port/dbname compare-models id-as-retured-by-get-last-successful-execution-command id-as-retured-by-init-command transform
5757
58-
$ python -m mcd postgresql+psycopg2://user:password@host:port/dbname complete-execution id-as-retured-by-init-command
58+
$ python -m dpo postgresql+psycopg2://user:password@host:port/dbname complete-execution id-as-retured-by-init-command
5959
```
6060

6161
## Prerequisites
@@ -90,9 +90,9 @@ To activate a virtual environment, run the following command:
9090
$ pipenv shell
9191
```
9292

93-
### Using MCD
93+
### Using DPO
9494

95-
Once the virtual environment has been activated, please refer to [usage](#Usage) for how to use MCD.
95+
Once the virtual environment has been activated, please refer to [usage](#Usage) for how to use DPO.
9696

9797
## Testing
9898

@@ -103,17 +103,23 @@ To run integration tests locally, it is highly recommended that [Docker](https:/
103103
To run unit tests, run the following command:
104104

105105
```
106-
$ python pytest
106+
$ pytest
107107
```
108108

109109
### Integration Tests
110110

111-
To run integration tests, please ensure the following information is configured correctly:
111+
Before running integration tests, please ensure the following information is configured correctly:
112112

113-
- `tests/integration/test_integration.sh:9`
113+
- `tests/integration/test_integration.sh:7`
114114

115115
Please ensure that the database connection string points to a valid PostgreSQL instance with valid parameters.
116116

117+
To run integration tests, run the following command:
118+
119+
```
120+
$ ./tests/integration/test_integration.sh
121+
```
122+
117123
#### Docker
118124

119125
If Docker is installed, running tests is as simple as running the following commands:
File renamed without changes.

mcd/ModelChangeDetector.py renamed to dpo/DataPipelineOrchestrator.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import argparse
22
import logging
33

4-
from mcd import Shared
5-
from mcd.BaseObject import BaseObject
6-
from mcd.Shared import Constants
7-
from mcd.commands.InitialiseExecutionCommand import InitialiseExecutionCommand
8-
from mcd.commands.GetLastSuccessfulExecutionCommand import GetLastSuccessfulExecutionCommand
9-
from mcd.commands.GetExecutionLastUpdateTimestampCommand import GetExecutionLastUpdateTimestampCommand
10-
from mcd.commands.PersistModelsCommand import PersistModelsCommand
11-
from mcd.commands.CompareModelsCommand import CompareModelsCommand
12-
from mcd.commands.CompleteExecutionCommand import CompleteExecutionCommand
13-
14-
15-
class ModelChangeDetector(BaseObject):
4+
from dpo import Shared
5+
from dpo.BaseObject import BaseObject
6+
from dpo.Shared import Constants
7+
from dpo.commands.InitialiseExecutionCommand import InitialiseExecutionCommand
8+
from dpo.commands.GetLastSuccessfulExecutionCommand import GetLastSuccessfulExecutionCommand
9+
from dpo.commands.GetExecutionLastUpdateTimestampCommand import GetExecutionLastUpdateTimestampCommand
10+
from dpo.commands.PersistModelsCommand import PersistModelsCommand
11+
from dpo.commands.CompareModelsCommand import CompareModelsCommand
12+
from dpo.commands.CompleteExecutionCommand import CompleteExecutionCommand
13+
14+
15+
class DataPipelineOrchestrator(BaseObject):
1616
def __init__(self, logger=None):
1717
self.args = self.__get_arguments()
1818
Shared.configure_root_logger(self.args.log_level)
@@ -51,10 +51,10 @@ def __process_complete_execution_command(self):
5151
def __get_arguments(self):
5252
parser = argparse.ArgumentParser(
5353
description=Constants.APP_NAME,
54-
usage='mcd [options] <db-connection-string> <command> [command-parameters]\n\n'
54+
usage='dpo [options] <db-connection-string> <command> [command-parameters]\n\n'
5555
'To see help text, you can run\n'
56-
' mcd --help\n'
57-
' mcd <db-connection-string> <command> --help\n\n',
56+
' dpo --help\n'
57+
' dpo <db-connection-string> <command> --help\n\n',
5858
parents=[Shared.get_default_arguments()])
5959

6060
parser.add_argument(

mcd/DataRepository.py renamed to dpo/DataRepository.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
from sqlalchemy import desc, select
22
from sqlalchemy.sql import func
33
from sqlalchemy.orm import sessionmaker
4-
from mcd import Shared
5-
from mcd.BaseObject import BaseObject
6-
from mcd.Shared import Constants
7-
from mcd.entities.DataPipelineExecutionEntity import DataPipelineExecutionEntity
8-
from mcd.entities.ModelChecksumEntity import ModelChecksumEntity
4+
from dpo import Shared
5+
from dpo.BaseObject import BaseObject
6+
from dpo.Shared import Constants
7+
from dpo.entities.DataPipelineExecutionEntity import DataPipelineExecutionEntity
8+
from dpo.entities.ModelChecksumEntity import ModelChecksumEntity
99

1010

1111
class DataRepository(BaseObject):

mcd/Shared.py renamed to dpo/Shared.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
class Constants:
9-
APP_NAME = 'model-change-detector'
9+
APP_NAME = 'data-pipeline-orchestrator'
1010
DATA_PIPELINE_EXECUTION_SCHEMA_NAME = 'data_pipeline'
1111
NO_LAST_SUCCESSFUL_EXECUTION = 'NO_LAST_SUCCESSFUL_EXECUTION'
1212

File renamed without changes.

dpo/__main__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from dpo.DataPipelineOrchestrator import DataPipelineOrchestrator
2+
3+
DataPipelineOrchestrator()

mcd/commands/BaseCommand.py renamed to dpo/commands/BaseCommand.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from sqlalchemy import create_engine
2-
from mcd.DataRepository import DataRepository
3-
from mcd.BaseObject import BaseObject
2+
from dpo.DataRepository import DataRepository
3+
from dpo.BaseObject import BaseObject
44

55

66
class BaseCommand(BaseObject):

mcd/commands/CompareModelsCommand.py renamed to dpo/commands/CompareModelsCommand.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from mcd.commands.BaseCommand import BaseCommand
2-
from mcd.Shared import Constants
1+
from dpo.commands.BaseCommand import BaseCommand
2+
from dpo.Shared import Constants
33

44

55
class CompareModelsCommand(BaseCommand):

mcd/commands/CompleteExecutionCommand.py renamed to dpo/commands/CompleteExecutionCommand.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import hashlib
22
from pathlib import Path
3-
from mcd.commands.BaseCommand import BaseCommand
3+
from dpo.commands.BaseCommand import BaseCommand
44

55

66
class CompleteExecutionCommand(BaseCommand):

0 commit comments

Comments
 (0)