Page MenuHomeSoftware Heritage

CLI: generalize 'map lookup' to lookup many identifiers at once
ClosedPublic

Authored by zack on Nov 30 2019, 2:50 PM.

Details

Summary

Multiple identifiers (of either kind) can be passed either directly on the CLI
or via stdin. In the latter case logical lines in stidn will be preserved in
stdout.

Closes T2112

Diff Detail

Repository
rDGRPH Graph service
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

zack updated this revision to Diff 8385.Nov 30 2019, 2:50 PM
zack created this revision.

Updating D2379: CLI: generalize 'map lookup' to lookup many identifiers at once

seirl requested changes to this revision.Dec 4 2019, 2:32 PM
seirl added inline comments.
swh/graph/cli.py
214

Isn't there an overhead to the mmap call here? Couldn't the mappings be created in the closure instead maybe?

230

for line in sys.stdin:

233

You're going to get a trailing space on all lines here, it might be significant at some point. It should be possible to str.join instead?

This revision now requires changes to proceed.Dec 4 2019, 2:32 PM
zack marked 3 inline comments as done.Dec 6 2019, 12:08 PM
zack added inline comments.
swh/graph/cli.py
230

(WTH was I thinking?)

233

Done.

Note that, as a consequence of this change, logical lines that contain non resolvable IDs will become ambiguous in the output feed (e.g., if you 4 IDs and one failed to resolve, you cannot determine which one failed to in the output). IMO that's fine, as inputs with non resolvable IDs are doomed to fail anyway.

zack updated this revision to Diff 8465.Dec 6 2019, 12:08 PM
zack marked 2 inline comments as done.

Updating D2379: CLI: generalize 'map lookup' to lookup many identifiers at once

seirl accepted this revision.Dec 6 2019, 3:44 PM
This revision is now accepted and ready to land.Dec 6 2019, 3:44 PM