Skip to content

Commit 4f4a328

Browse files
authored
Merge pull request #121 from OpenDataAlex/process_tracker_python-118
Process tracker python 118
2 parents 8bce79b + dbd1414 commit 4f4a328

File tree

6 files changed

+28
-26
lines changed

6 files changed

+28
-26
lines changed

dbscripts/mysql_process_tracker.sql

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ create table process_contact
489489
foreign key (contact_id) references contact_lkup (contact_id)
490490
);
491491

492-
create table source_object_attribute
492+
create table source_object_attribute_lkup
493493
(
494494
source_object_attribute_id int auto_increment
495495
primary key,
@@ -504,11 +504,11 @@ create table source_object_attribute
504504
default_value_number decimal null,
505505
is_key boolean default FALSE not null,
506506
is_filter boolean default FALSE not null,
507-
constraint source_object_attribute_udx01
507+
constraint source_object_attribute_lkup_udx01
508508
unique (source_object_id, source_object_attribute_name),
509-
constraint source_object_attribute_fk01
509+
constraint source_object_attribute_lkup_fk01
510510
foreign key (source_object_id) references source_object_lkup (source_object_id),
511-
constraint source_object_attribute_fk02
511+
constraint source_object_attribute_lkup_fk02
512512
foreign key (data_type_id) references data_type_lkup (data_type_id)
513513
);
514514

@@ -522,7 +522,7 @@ create table process_source_object_attribute
522522
constraint process_source_object_attribute_fk01
523523
foreign key (process_id) references process (process_id),
524524
constraint process_source_object_attribute_fk02
525-
foreign key (source_object_attribute_id) references source_object_attribute (source_object_attribute_id)
525+
foreign key (source_object_attribute_id) references source_object_attribute_lkup (source_object_attribute_id)
526526
);
527527

528528
create table if not exists process_target_object_attribute
@@ -535,7 +535,7 @@ create table if not exists process_target_object_attribute
535535
constraint process_target_object_attribute_fk01
536536
foreign key (process_id) references process (process_id),
537537
constraint process_target_object_attribute_fk02
538-
foreign key (target_object_attribute_id) references source_object_attribute (source_object_attribute_id)
538+
foreign key (target_object_attribute_id) references source_object_attribute_lkup (source_object_attribute_id)
539539
);
540540

541541
create table filter_type_lkup
@@ -564,7 +564,7 @@ create table process_filter
564564
constraint process_filter_fk01
565565
foreign key (process_id) references process (process_id),
566566
constraint process_filter_fk02
567-
foreign key (source_object_attribute_id) references source_object_attribute (source_object_attribute_id),
567+
foreign key (source_object_attribute_id) references source_object_attribute_lkup (source_object_attribute_id),
568568
constraint process_filter_fk03
569569
foreign key (filter_type_id) references filter_type_lkup (filter_type_id)
570570
);

dbscripts/postgresql_process_tracker.sql

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -727,18 +727,18 @@ create table process_contact
727727

728728
alter table process_contact owner to pt_admin;
729729

730-
create table process_tracker.source_object_attribute
730+
create table process_tracker.source_object_attribute_lkup
731731
(
732732
source_object_attribute_id serial not null
733-
constraint source_object_attribute_pk
733+
constraint source_object_attribute_lkup_pk
734734
primary key,
735735
source_object_attribute_name varchar(250) not null,
736736
source_object_id integer
737-
constraint source_object_attribute_fk01
737+
constraint source_object_attribute_lkup_fk01
738738
references process_tracker.source_object_lkup,
739739
attribute_path varchar(750),
740740
data_type_id integer
741-
constraint source_object_attribute_fk02
741+
constraint source_object_attribute_lkup_fk02
742742
references process_tracker.data_type_lkup,
743743
data_length integer,
744744
data_decimal integer,
@@ -749,10 +749,10 @@ create table process_tracker.source_object_attribute
749749
is_filter boolean default false not null
750750
);
751751

752-
alter table process_tracker.source_object_attribute owner to pt_admin;
752+
alter table process_tracker.source_object_attribute_lkup owner to pt_admin;
753753

754-
create unique index source_object_attribute_udx01
755-
on process_tracker.source_object_attribute (source_object_id, source_object_attribute_name);
754+
create unique index source_object_attribute_lkup_udx01
755+
on process_tracker.source_object_attribute_lkup (source_object_id, source_object_attribute_name);
756756

757757
create table process_tracker.process_target_object_attribute
758758
(
@@ -761,7 +761,7 @@ create table process_tracker.process_target_object_attribute
761761
references process_tracker.process,
762762
target_object_attribute_id integer not null
763763
constraint process_target_object_attribute_fk02
764-
references process_tracker.source_object_attribute,
764+
references process_tracker.source_object_attribute_lkup,
765765
target_object_attribute_alias varchar(250),
766766
target_object_attribute_expression varchar(250),
767767
constraint process_target_object_attribute_pk
@@ -777,7 +777,7 @@ create table process_tracker.process_source_object_attribute
777777
references process_tracker.process,
778778
source_object_attribute_id integer not null
779779
constraint process_source_object_attribute_fk02
780-
references process_tracker.source_object_attribute,
780+
references process_tracker.source_object_attribute_lkup,
781781
source_object_attribute_alias varchar(250),
782782
source_object_attribute_expression varchar(250),
783783
constraint process_source_object_attribute_pk
@@ -797,7 +797,7 @@ create table process_tracker.process_filter
797797
references process_tracker.process,
798798
source_object_attribute_id integer not null
799799
constraint process_filter_fk02
800-
references process_tracker.source_object_attribute,
800+
references process_tracker.source_object_attribute_lkup,
801801
filter_type_id integer not null
802802
constraint process_filter_fk03
803803
references process_tracker.filter_type_lkup,

process_tracker/models/process.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ class ProcessFilter(Base):
250250
source_object_attribute_id = Column(
251251
Integer,
252252
ForeignKey(
253-
"process_tracker.source_object_attribute.source_object_attribute_id"
253+
"process_tracker.source_object_attribute_lkup.source_object_attribute_id"
254254
),
255255
nullable=False,
256256
)
@@ -344,7 +344,7 @@ class ProcessSourceObjectAttribute(Base):
344344
source_object_attribute_id = Column(
345345
Integer,
346346
ForeignKey(
347-
"process_tracker.source_object_attribute.source_object_attribute_id"
347+
"process_tracker.source_object_attribute_lkup.source_object_attribute_id"
348348
),
349349
primary_key=True,
350350
nullable=False,
@@ -430,7 +430,7 @@ class ProcessTargetObjectAttribute(Base):
430430
target_object_attribute_id = Column(
431431
Integer,
432432
ForeignKey(
433-
"process_tracker.source_object_attribute.source_object_attribute_id"
433+
"process_tracker.source_object_attribute_lkup.source_object_attribute_id"
434434
),
435435
primary_key=True,
436436
nullable=False,

process_tracker/models/source.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def __repr__(self):
196196

197197
class SourceObjectAttribute(Base):
198198

199-
__tablename__ = "source_object_attribute"
199+
__tablename__ = "source_object_attribute_lkup"
200200
__table_args__ = {"schema": "process_tracker"}
201201

202202
source_object_attribute_id = Column(

process_tracker/process_tracker.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ def register_new_process_run(self):
810810
last_run_id=last_run.process_run_id,
811811
):
812812
self.logger.error(
813-
"Process is on hold due to number of concurrent failures or previous run is in on hold status."
813+
"Process is on hold due to number of concurrent failures or previous run is in on-hold status."
814814
)
815815
new_run_flag = False
816816

@@ -833,7 +833,8 @@ def register_new_process_run(self):
833833

834834
else:
835835
raise Exception(
836-
"The process %s is currently running or on hold." % self.process_name
836+
"The process %s is currently %s."
837+
% (self.process_name, last_run.status.process_status_name)
837838
)
838839

839840
def register_process_dataset_types(self, dataset_types):

tests/test_process_tracker.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ def test_process_on_hold_max_failures(self):
750750
)
751751

752752
self.assertTrue(
753-
"The process On Hold Max Failures Test is currently running or on_hold."
753+
"The process On Hold Max Failures Test is currently on hold."
754754
in str(context.exception)
755755
)
756756

@@ -809,7 +809,7 @@ def test_process_on_hold_previous_run_on_hold(self):
809809
)
810810

811811
self.assertTrue(
812-
"The process On Hold Previous Run Test is currently running or on hold."
812+
"The process On Hold Previous Run Test is currently on hold."
813813
in str(context.exception)
814814
)
815815

@@ -903,6 +903,7 @@ def test_register_extracts_by_location_local(self):
903903
"TRAVIS" in os.environ and os.environ["TRAVIS"] == "true",
904904
"Skipping this test on Travis CI.",
905905
)
906+
@unittest.skip("Issue with hanging queries on database.")
906907
@mock_s3
907908
def test_register_extracts_by_location_s3(self):
908909
"""
@@ -1034,7 +1035,7 @@ def test_register_new_process_run_exception(self):
10341035
self.process_tracker.register_new_process_run()
10351036

10361037
return self.assertTrue(
1037-
"The process Testing Process Tracking Initialization is currently running or on hold."
1038+
"The process Testing Process Tracking Initialization is currently running."
10381039
in str(context.exception)
10391040
)
10401041

0 commit comments

Comments
 (0)