Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-dataset
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
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
Antoine Lambert
swh-dataset
Commits
d2ebe07e
Commit
d2ebe07e
authored
4 years ago
by
Thibault Allançon
Browse files
Options
Downloads
Patches
Plain Diff
graph: replace deprecated persistent_identifier method
Use the new SWHID naming convention instead of SWH PID.
parent
48ba2a40
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swh/dataset/graph.py
+7
-7
7 additions, 7 deletions
swh/dataset/graph.py
with
7 additions
and
7 deletions
swh/dataset/graph.py
+
7
−
7
View file @
d2ebe07e
...
...
@@ -15,7 +15,7 @@ import uuid
from
swh.dataset.exporter
import
ParallelExporter
from
swh.dataset.utils
import
SQLiteSet
,
ZSTFile
from
swh.model.identifiers
import
origin_identifier
,
persistent_identifier
from
swh.model.identifiers
import
origin_identifier
,
swhid
from
swh.storage.fixer
import
fix_objects
...
...
@@ -32,17 +32,17 @@ def process_messages(messages, config, node_writer, edge_writer, node_set):
node_type
,
node_id
=
node
if
node_id
is
None
:
return
node_
p
id
=
persistent_identifier
(
object_type
=
node_type
,
object_id
=
node_id
)
node_writer
.
write
(
"
{}
\n
"
.
format
(
node_
p
id
))
node_
swh
id
=
swhid
(
object_type
=
node_type
,
object_id
=
node_id
)
node_writer
.
write
(
"
{}
\n
"
.
format
(
node_
swh
id
))
def
write_edge
(
src
,
dst
):
src_type
,
src_id
=
src
dst_type
,
dst_id
=
dst
if
src_id
is
None
or
dst_id
is
None
:
return
src_
p
id
=
persistent_identifier
(
object_type
=
src_type
,
object_id
=
src_id
)
dst_
p
id
=
persistent_identifier
(
object_type
=
dst_type
,
object_id
=
dst_id
)
edge_writer
.
write
(
"
{} {}
\n
"
.
format
(
src_
p
id
,
dst_
p
id
))
src_
swh
id
=
swhid
(
object_type
=
src_type
,
object_id
=
src_id
)
dst_
swh
id
=
swhid
(
object_type
=
dst_type
,
object_id
=
dst_id
)
edge_writer
.
write
(
"
{} {}
\n
"
.
format
(
src_
swh
id
,
dst_
swh
id
))
messages
=
{
k
:
fix_objects
(
k
,
v
)
for
k
,
v
in
messages
.
items
()}
...
...
@@ -121,7 +121,7 @@ class GraphEdgeExporter(ParallelExporter):
Implementation of ParallelExporter which writes all the graph edges
of a specific type in a Zstandard-compressed CSV file.
Each row of the CSV is in the format: `<SRC
P
ID> <DST
P
ID>
Each row of the CSV is in the format: `<SRC
SWH
ID> <DST
SWH
ID>
"""
def
export_worker
(
self
,
export_path
,
**
kwargs
):
...
...
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