Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Pypelines
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
Releases
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
HaissLab
Data Management
Pypelines
Commits
b4510e62
Commit
b4510e62
authored
1 year ago
by
Timothe Jost
Browse files
Options
Downloads
Patches
Plain Diff
test
parent
9303d344
No related branches found
No related tags found
No related merge requests found
Pipeline
#127817
passed
1 year ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/pypelines/__init__.py
+1
-1
1 addition, 1 deletion
src/pypelines/__init__.py
src/pypelines/celery_tasks.py
+9
-4
9 additions, 4 deletions
src/pypelines/celery_tasks.py
with
10 additions
and
5 deletions
src/pypelines/__init__.py
+
1
−
1
View file @
b4510e62
__version__
=
"
0.0.
49
"
__version__
=
"
0.0.
50
"
from
.
import
loggs
from
.
import
loggs
from
.pipes
import
*
from
.pipes
import
*
...
...
This diff is collapsed.
Click to expand it.
src/pypelines/celery_tasks.py
+
9
−
4
View file @
b4510e62
...
@@ -471,24 +471,29 @@ def create_celery_app(conf_path, app_name="pypelines", v_host=None) -> "Celery |
...
@@ -471,24 +471,29 @@ def create_celery_app(conf_path, app_name="pypelines", v_host=None) -> "Celery |
# logger.warning(f"Local tasks are : {self.tasks}")
# logger.warning(f"Local tasks are : {self.tasks}")
else
:
else
:
if
datetime
.
now
()
>
app_task_data
[
"
refresh_time
"
]:
# we refresh if refresh time is elapsed
now
=
datetime
.
now
()
if
now
>
app_task_data
[
"
refresh_time
"
]:
# we refresh if refresh time is elapsed
logger
.
warning
(
"
Time has come to auto refresh app_task_data.
"
f
"
refresh_time was
{
app_task_data
[
'
refresh_time
'
]
}
and now is
{
now
}
"
)
refresh
=
True
refresh
=
True
if
refresh
:
if
refresh
:
try
:
try
:
task_data
=
self
.
tasks
[
f
"
{
app_name
}
.tasks_infos
"
].
delay
(
app_name
).
get
(
timeout
=
2
)
task_data
=
self
.
tasks
[
f
"
{
app_name
}
.tasks_infos
"
].
delay
(
app_name
).
get
(
timeout
=
2
)
# if the data needs to be refreshed, we don't wait for as long as for a first get of infos.
# if the data needs to be refreshed, we don't wait for as long as for a first get of infos.
app_task_data
=
{
"
task_data
"
:
task_data
,
"
refresh_time
"
:
datetime
.
now
()
+
auto_refresh_time
}
app_task_data
=
{
"
task_data
"
:
task_data
,
"
refresh_time
"
:
now
+
auto_refresh_time
}
logger
.
warning
(
"
Refreshed celery tasks data sucessfully
"
)
logger
.
warning
(
"
Refreshed celery tasks data sucessfully
"
)
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
warning
(
logger
.
warning
(
"
Could not refresh tasks data from remote celery worker. All workers are is probably running.
"
"
Could not refresh tasks data from remote celery worker. All workers are is probably running.
"
f
"
{
e
}
"
f
"
{
e
}
"
)
)
app_task_data
[
"
refresh_time
"
]
=
datetime
.
now
()
+
failed_refresh_retry_time
app_task_data
[
"
refresh_time
"
]
=
now
+
failed_refresh_retry_time
setattr
(
self
,
"
task_data
"
,
app_task_data
)
setattr
(
self
,
"
task_data
"
,
app_task_data
)
else
:
else
:
delta
=
(
app_task_data
[
"
refresh_time
"
]
-
datetime
.
now
()
).
total_seconds
()
delta
=
(
app_task_data
[
"
refresh_time
"
]
-
now
).
total_seconds
()
logger
.
warning
(
f
"
Returned cached task_data. Next refresh will happen in at least
{
delta
}
seconds
"
)
logger
.
warning
(
f
"
Returned cached task_data. Next refresh will happen in at least
{
delta
}
seconds
"
)
return
app_task_data
[
"
task_data
"
]
if
app_task_data
is
not
None
else
None
return
app_task_data
[
"
task_data
"
]
if
app_task_data
is
not
None
else
None
...
...
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