Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scp_udg_client_python_app
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cross
scp_udg_client_python_app
Commits
e8e52e9e
Commit
e8e52e9e
authored
8 months ago
by
Tito Brasolin
Browse files
Options
Downloads
Patches
Plain Diff
fix: do not retry existing datasets
parent
a9497753
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scp_udg_client_app/commands/push.py
+20
-6
20 additions, 6 deletions
scp_udg_client_app/commands/push.py
with
20 additions
and
6 deletions
scp_udg_client_app/commands/push.py
+
20
−
6
View file @
e8e52e9e
...
...
@@ -274,16 +274,24 @@ def process_pending_files(pending_dir, retry_dirs, retry, nosent_dir, oksent_dir
if
response_code
!=
PUSH_SUCCESSFUL_CODE
or
response_detail
==
"
UrbanDataset already exists
"
:
# noinspection PyUnresolvedReferences
try_count
=
int
(
file_info
[
"
try_count
"
])
nosent_response_path
=
os
.
path
.
join
(
nosent_dir
,
response_code
)
Path
(
nosent_response_path
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
if
response_code
==
PUSH_SUCCESSFUL_CODE
:
logger
.
info
(
f
"
- UrbanDataset already exists. File
{
file_name
}
will be moved to
{
nosent_response_path
}
and never retried.
"
)
move_file
(
src
,
nosent_response_path
)
del
pushed_files_info
[
file_name
]
continue
# noinspection PyUnresolvedReferences
try_count
=
int
(
file_info
[
"
try_count
"
])
# noinspection PyUnresolvedReferences
if
(
not
response_code
or
response_code
in
retry_dirs
)
and
try_count
<=
retry
:
logger
.
info
(
f
"
- File
{
file_name
}
will be copied to
{
nosent_response_path
}
and retried later.
"
)
copy_file
(
src
,
nosent_response_path
)
logger
.
info
(
f
"
- File
{
file_name
}
has been attempted
{
try_count
}
time(s) and will be retried later.
"
)
# Decommentare la riga seguente se si desidera che resti traccia di tutti i tentativi.
# copy_file(src, nosent_response_path)
pushed_files_info
[
file_name
][
"
processed
"
]
=
True
else
:
logger
.
info
(
f
"
- File
{
file_name
}
will be moved to
{
nosent_response_path
}
and never retried.
"
)
...
...
@@ -334,7 +342,8 @@ def job(poller):
@click.option
(
'
--token-file
'
,
type
=
click
.
Path
(
readable
=
True
,
dir_okay
=
False
),
default
=
'
token.json
'
,
show_envvar
=
True
,
help
=
'
Path to the file containing the login response. [default: token.json]
'
)
@click.option
(
'
--is-json
'
,
is_flag
=
True
,
default
=
False
,
hidden
=
True
,
help
=
'
Flag to handle token as JSON.
'
)
@login_options
@click.option
(
'
--username
'
,
prompt
=
True
,
prompt_required
=
False
,
show_envvar
=
True
,
help
=
'
Your username.
'
)
@click.password_option
(
'
--password
'
,
prompt_required
=
False
,
show_envvar
=
True
,
help
=
'
Your password.
'
)
@outbox_dir_options
@click.option
(
'
--retry-dirs
'
,
type
=
StringListParamType
(
ignore_empty
=
True
),
default
=
""
,
help
=
"
Directory interne a --nosent-dir soggette a retry.
"
,
show_envvar
=
True
)
...
...
@@ -365,6 +374,11 @@ def push(ctx, outbox_dir, oksent_dir, nosent_dir, retry_dirs, retry, retry_frequ
if
continuous
and
(
not
username
or
not
password
):
raise
click
.
UsageError
(
"
Username and password are required if continuous mode is enabled!
"
)
# Verify if PUSH_SUCCESSFUL_CODE is present in retry_dirs and log a warning if so
if
PUSH_SUCCESSFUL_CODE
in
retry_dirs
:
logger
.
warning
(
f
"
Code
'
{
PUSH_SUCCESSFUL_CODE
}
'
is in retry_dirs. These submissions are considered successful
"
"
and will therefore not be retried, even if the file is placed in the
'
no sent
'
directory.
"
)
global
api_instance
api_instance
=
get_api_instance
(
ctx
,
udg_endpoint
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment