Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Maják
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
Container registry
Model registry
Operate
Environments
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
TO
Maják
Commits
99dbe210
Commit
99dbe210
authored
5 months ago
by
Alexa Valentová
Browse files
Options
Downloads
Patches
Plain Diff
handle transport server errors
parent
b59929c2
No related branches found
No related tags found
2 merge requests
!1200
handle transport server errors
,
!1198
handle transport server errors
Pipeline
#20173
passed
5 months ago
Stage: build
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
shared/people_import.py
+12
-3
12 additions, 3 deletions
shared/people_import.py
with
12 additions
and
3 deletions
shared/people_import.py
+
12
−
3
View file @
99dbe210
...
@@ -7,6 +7,7 @@ import requests
...
@@ -7,6 +7,7 @@ import requests
from
django.conf
import
settings
from
django.conf
import
settings
from
django.core.files.images
import
ImageFile
from
django.core.files.images
import
ImageFile
from
gql
import
Client
,
gql
from
gql
import
Client
,
gql
from
gql.transport.exceptions
import
TransportServerError
from
gql.transport.aiohttp
import
AIOHTTPTransport
from
gql.transport.aiohttp
import
AIOHTTPTransport
from
wagtail.images.models
import
Image
from
wagtail.images.models
import
Image
from
wagtail.models.media
import
Collection
from
wagtail.models.media
import
Collection
...
@@ -447,7 +448,7 @@ class PeopleTeamImporter(ImporterMixin):
...
@@ -447,7 +448,7 @@ class PeopleTeamImporter(ImporterMixin):
if
os
.
path
.
exists
(
lock_file_name
):
if
os
.
path
.
exists
(
lock_file_name
):
os
.
remove
(
lock_file_name
)
os
.
remove
(
lock_file_name
)
def
get_people_ids_from_
group
(
self
):
def
get_people_ids_from_
team
(
self
):
query
=
gql
(
query
=
gql
(
f
"""
f
"""
query {{
query {{
...
@@ -473,7 +474,15 @@ class PeopleTeamImporter(ImporterMixin):
...
@@ -473,7 +474,15 @@ class PeopleTeamImporter(ImporterMixin):
"""
"""
)
)
result
=
self
.
client
.
execute
(
query
)
try
:
result
=
self
.
client
.
execute
(
query
)
except
TransportServerError
as
exception
:
logger
.
warning
(
f
"
Error getting data for group %s: %s
"
,
self
.
team_shortcut
,
str
(
exception
)
)
return
[]
users
=
[]
users
=
[]
...
@@ -540,7 +549,7 @@ class PeopleTeamImporter(ImporterMixin):
...
@@ -540,7 +549,7 @@ class PeopleTeamImporter(ImporterMixin):
)
)
try
:
try
:
people_ids
=
self
.
get_people_ids_from_
group
()
people_ids
=
self
.
get_people_ids_from_
team
()
people_profiles
=
self
.
get_processed_people_profiles
(
people_ids
)
people_profiles
=
self
.
get_processed_people_profiles
(
people_ids
)
people_instances
=
self
.
create_and_update_people_models
(
people_profiles
)
people_instances
=
self
.
create_and_update_people_models
(
people_profiles
)
...
...
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