Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
wendelin
Commits
e1dd6f06
Commit
e1dd6f06
authored
May 04, 2020
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handling any exception to log is bad as you already have error_log.
parent
98f0da9d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
51 deletions
+47
-51
bt5/erp5_wendelin_data_lake_ingestion/SkinTemplateItem/portal_skins/erp5_wendelin_data_lake/ingestionReferenceExists.py
...skins/erp5_wendelin_data_lake/ingestionReferenceExists.py
+47
-51
No files found.
bt5/erp5_wendelin_data_lake_ingestion/SkinTemplateItem/portal_skins/erp5_wendelin_data_lake/ingestionReferenceExists.py
View file @
e1dd6f06
...
@@ -14,22 +14,21 @@ reference_separator = portal.getIngestionReferenceDictionary()["reference_separa
...
@@ -14,22 +14,21 @@ reference_separator = portal.getIngestionReferenceDictionary()["reference_separa
reference_end_single
=
portal
.
getIngestionReferenceDictionary
()[
"single_end_suffix"
]
reference_end_single
=
portal
.
getIngestionReferenceDictionary
()[
"single_end_suffix"
]
reference_end_split
=
portal
.
getIngestionReferenceDictionary
()[
"split_end_suffix"
]
reference_end_split
=
portal
.
getIngestionReferenceDictionary
()[
"split_end_suffix"
]
try
:
# remove supplier and eof from reference
# remove supplier and eof from reference
data_ingestion_reference
=
reference_separator
.
join
(
reference
.
split
(
reference_separator
)[
1
:
-
3
])
data_ingestion_reference
=
reference_separator
.
join
(
reference
.
split
(
reference_separator
)[
1
:
-
3
])
EOF
=
reference
.
split
(
reference_separator
)[
-
3
]
EOF
=
reference
.
split
(
reference_separator
)[
-
3
]
size
=
reference
.
split
(
reference_separator
)[
-
2
]
size
=
reference
.
split
(
reference_separator
)[
-
2
]
if
data_ingestion_reference
is
""
:
if
data_ingestion_reference
is
""
:
context
.
logEntry
(
"[ERROR] Data Ingestion reference parameter for ingestionReferenceExists script is not well formated"
)
context
.
logEntry
(
"[ERROR] Data Ingestion reference parameter for ingestionReferenceExists script is not well formated"
)
raise
ValueError
(
"Data Ingestion reference is not well formated"
)
raise
ValueError
(
"Data Ingestion reference is not well formated"
)
# check if there are started ingestions for this reference
# check if there are started ingestions for this reference
data_ingestion
=
portal_catalog
.
getResultValue
(
data_ingestion
=
portal_catalog
.
getResultValue
(
portal_type
=
'Data Ingestion'
,
portal_type
=
'Data Ingestion'
,
simulation_state
=
"started"
,
simulation_state
=
"started"
,
reference
=
data_ingestion_reference
)
reference
=
data_ingestion_reference
)
if
data_ingestion
!=
None
:
if
data_ingestion
!=
None
:
try
:
try
:
# check if user tries to restart the previous split ingestion
# check if user tries to restart the previous split ingestion
if
(
EOF
==
""
or
EOF
==
reference_end_single
)
or
(
EOF
!=
reference_end_split
and
int
(
EOF
)
==
1
):
if
(
EOF
==
""
or
EOF
==
reference_end_single
)
or
(
EOF
!=
reference_end_split
and
int
(
EOF
)
==
1
):
...
@@ -50,18 +49,15 @@ try:
...
@@ -50,18 +49,15 @@ try:
# the ingestion attemp corresponds to a split ingestion in course, accept
# the ingestion attemp corresponds to a split ingestion in course, accept
return
FALSE
return
FALSE
data_ingestion
=
portal_catalog
.
getResultValue
(
data_ingestion
=
portal_catalog
.
getResultValue
(
portal_type
=
'Data Ingestion'
,
portal_type
=
'Data Ingestion'
,
reference
=
data_ingestion_reference
)
reference
=
data_ingestion_reference
)
if
data_ingestion
is
None
:
if
data_ingestion
is
None
:
return
FALSE
return
FALSE
# TODO: fix this (contemplate scenarios of partial ingestion overwrites)
# TODO: fix this (contemplate scenarios of partial ingestion overwrites)
if
size
!=
""
and
size
!=
None
:
if
size
!=
""
and
size
!=
None
:
# this is a modified file
# this is a modified file
return
FALSE
return
FALSE
return
TRUE
return
TRUE
except
Exception
as
e
:
context
.
logEntry
(
''
.
join
([
"[ERROR] At script ingestionReferenceExists: "
,
str
(
e
)]))
raise
e
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment