From 1b6d04fffb6554fd8ef1479b29c7154df07e4d21 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 30 Mar 2018 17:57:34 -0700 Subject: pytest helpers --- backfill/Pipfile | 11 +- backfill/Pipfile.lock | 577 ++++++++++++++++++++++++++++++++++-- backfill/backfill_hbase_from_cdx.py | 169 +++++++++++ backfill/cdx_fulltext_to_hbase.py | 169 ----------- backfill/pytest.ini | 8 + 5 files changed, 733 insertions(+), 201 deletions(-) create mode 100755 backfill/backfill_hbase_from_cdx.py delete mode 100755 backfill/cdx_fulltext_to_hbase.py create mode 100644 backfill/pytest.ini (limited to 'backfill') diff --git a/backfill/Pipfile b/backfill/Pipfile index 83dc463..e986fee 100644 --- a/backfill/Pipfile +++ b/backfill/Pipfile @@ -1,21 +1,16 @@ [[source]] - url = "https://pypi.python.org/simple" verify_ssl = true name = "pypi" - [dev-packages] - - [packages] - happybase = "*" happybase-mock = "*" -nose = "*" - +pytest = "*" +mrjob = "*" +pytest-pythonpath = "*" [requires] - python_version = "3.5" diff --git a/backfill/Pipfile.lock b/backfill/Pipfile.lock index b525871..9aaa211 100644 --- a/backfill/Pipfile.lock +++ b/backfill/Pipfile.lock @@ -1,20 +1,7 @@ { "_meta": { "hash": { - "sha256": "ede8d6f8c246a58f84fffe98979d8c17f624535aba1e23aa0539308859f2ffa1" - }, - "host-environment-markers": { - "implementation_name": "cpython", - "implementation_version": "3.5.3", - "os_name": "posix", - "platform_machine": "x86_64", - "platform_python_implementation": "CPython", - "platform_release": "4.9.0-6-amd64", - "platform_system": "Linux", - "platform_version": "#1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02)", - "python_full_version": "3.5.3", - "python_version": "3.5", - "sys_platform": "linux" + "sha256": "9484f26847863001264eddd25c2b09f7b701138a80a9abd2a326cd5d676709be" }, "pipfile-spec": 6, "requires": { @@ -29,10 +16,331 @@ ] }, "default": { + "attrs": { + "hashes": [ + "sha256:1c7960ccfd6a005cd9f7ba884e6316b5e430a3f1a6c37c5f87d8b43f83b54ec9", + "sha256:a17a9573a6f475c99b551c0e0a812707ddda1ec9653bed04c13841404ed6f450" + ], + "version": "==17.4.0" + }, + "boto3": { + "hashes": [ + "sha256:926910b77d5f8037527ff81a91b92e7a9100685b297e3ebd12dd584e5b0386bb", + "sha256:9713d381409c5abbff8d8f2c9ebf9713e5aeb6cd12bd16503d61978dbd4f77a6" + ], + "version": "==1.6.21" + }, + "botocore": { + "hashes": [ + "sha256:039b768f5d248e13c1fb4be739523d7d1d75133a563dd212e932f3fc973bffb9", + "sha256:c954af8b33232f25df496c9e7e5f6dbcef081ef7163eadfc22a4bd9ce69dcc56" + ], + "version": "==1.9.21" + }, + "cachetools": { + "hashes": [ + "sha256:4319bbb78172e7bcf99423e1ecd6914b32336ccfe97d2058ffe62e641a7f3abe", + "sha256:ede01f2d3cbd6ddc9e35e16c2b0ce011d8bb70ce0dbaf282f5b4df24b213bc5d" + ], + "version": "==2.0.1" + }, + "certifi": { + "hashes": [ + "sha256:14131608ad2fd56836d33a71ee60fa1c82bc9d2c8d98b7bdbc631fe1b3cd1296", + "sha256:edbc3f203427eef571f79a7692bb160a2b0f7ccaa31953e99bd17e307cf63f7d" + ], + "version": "==2018.1.18" + }, + "chardet": { + "hashes": [ + "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", + "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691" + ], + "version": "==3.0.4" + }, + "dill": { + "hashes": [ + "sha256:97fd758f5fe742d42b11ec8318ecfcff8776bccacbfcec05dfd6276f5d450f73" + ], + "version": "==0.2.7.1" + }, + "docutils": { + "hashes": [ + "sha256:02aec4bd92ab067f6ff27a38a38a41173bf01bed8f89157768c1573f53e474a6", + "sha256:51e64ef2ebfb29cae1faa133b3710143496eca21c530f3f71424d77687764274", + "sha256:7a4bd47eaf6596e1295ecb11361139febe29b084a87bf005bf899f9a42edc3c6" + ], + "version": "==0.14" + }, + "future": { + "hashes": [ + "sha256:e39ced1ab767b5936646cedba8bcce582398233d6a627067d4c6a454c90cfedb" + ], + "version": "==0.16.0" + }, + "gapic-google-cloud-datastore-v1": { + "hashes": [ + "sha256:d5d0e6f7b4996a8dd5f4f5ad27cd389a5d7bedd07e6e9b9f3a4a3c3ea56d9053" + ], + "version": "==0.15.3" + }, + "gapic-google-cloud-error-reporting-v1beta1": { + "hashes": [ + "sha256:39f3f8e974441fb57ea98d0be0f4cdedd18cda9a628aec31e1f0841affab6f16" + ], + "version": "==0.15.3" + }, + "gapic-google-cloud-logging-v2": { + "hashes": [ + "sha256:b0b87bf56c50e4617fb539e5c36f2e286ba87c67a9b1ef5c9ec854d6d7b10023" + ], + "version": "==0.91.3" + }, + "google-api-core": { + "hashes": [ + "sha256:0144d467083ed54d2e8ccb4212d42c3724fe0b844b7d3a0ff85aea54b7ae8347", + "sha256:1698e4af4edd2a8ec22d678fd9abe99c926c3a154b2232f32807946ca49e3da1" + ], + "version": "==0.1.4" + }, + "google-auth": { + "hashes": [ + "sha256:34088434cb2a2409360b8f3cbc04195a465df1fb2aafad71ebbded77cbf08803", + "sha256:9051802d3dae256036cca9e34633a32c0ed1427730d4ebc513dff91ec8b6dd45" + ], + "version": "==1.4.1" + }, + "google-cloud": { + "hashes": [ + "sha256:21a11ad63cc29cfd4e4b6426947bdc2cbefe080f87ad68fa432cf2ac108cb87d", + "sha256:a99ee610e058c2af84ca1da710afe80fca022d2572c4bce78f6fdecac6b32d07" + ], + "version": "==0.32.0" + }, + "google-cloud-bigquery": { + "hashes": [ + "sha256:1c5a42332b43b58d6039fbca697a88c230487212afb6b4a6cbe0d5f3d5685785", + "sha256:511f27e5e398f8bb4dcad914596e32fe5bcb111257f032d93956a2dcced4a00f" + ], + "version": "==0.28.0" + }, + "google-cloud-bigquery-datatransfer": { + "hashes": [ + "sha256:c0a290f9456b52c633cf966c73311038eb2d3fd5a61b40059edad966a434e4f9", + "sha256:f5b5d0de43805fa9ebb620c58e1d27e6d32d2fc8e9a2f954ee170f7a026c8757" + ], + "version": "==0.1.1" + }, + "google-cloud-bigtable": { + "hashes": [ + "sha256:22c7148dc339be791d2bf4616c87e523507618570356148375c631de412f551b", + "sha256:7f86d2c8d7f22670da98fd67bcdc17cab793f7400725c8148b05ad829c02b95e" + ], + "version": "==0.28.1" + }, + "google-cloud-container": { + "hashes": [ + "sha256:275de3032de5696cd976459966e911abd3a1b624c7a918a8137a0308898e4f90", + "sha256:a89afcb1fe96bc9361c231c223c3bbe19fa3787caeb4697cd5778990e1077270" + ], + "version": "==0.1.1" + }, + "google-cloud-core": { + "hashes": [ + "sha256:0090df83dbc5cb2405fa90844366d13176d1c0b48181c1807ab15f53be403f73", + "sha256:89e8140a288acec20c5e56159461d3afa4073570c9758c05d4e6cb7f2f8cc440" + ], + "version": "==0.28.1" + }, + "google-cloud-dataproc": { + "hashes": [ + "sha256:1096534affe51b2e54b7c57f429b83c4566f92ed42fdee6613a001649c61c3d5", + "sha256:8537b0de721ec4524cb580572f44f88d2b22a1f5c56968448003ca9023ecb951" + ], + "version": "==0.1.0" + }, + "google-cloud-datastore": { + "hashes": [ + "sha256:3094b38df19a0a6663b614122d97efcfeab35baf770070e960f6792522307997", + "sha256:7cc7a48945dd0ec8aea2d8a169f8a3dfd84608392b00b514b4421b5a716b3263" + ], + "version": "==1.4.0" + }, + "google-cloud-dns": { + "hashes": [ + "sha256:2edcb33ea0025545746962839373ff6d314a5fac779fd7f7ddd0e592196fbb14", + "sha256:5db79c21a2ee72854609db88d5a4ae897c32bf77bf6b51b3290e013b2db49e07" + ], + "version": "==0.28.0" + }, + "google-cloud-error-reporting": { + "hashes": [ + "sha256:6398c5963599f834d2ba2effbca4f67dbd21034252d33d0f367d1a7c868cfb98", + "sha256:d4bdc20b5704afddc12a464622153c250be62a9d38a57d0f9371a0a3f3e43c71" + ], + "version": "==0.28.0" + }, + "google-cloud-firestore": { + "hashes": [ + "sha256:91b1373faf1c763ce9cda915a82655918035e4d09e8d2399170122f94274c977", + "sha256:c12fe5a017a56c8d617bdf83ace3970afba886c09fc0d6c0d24f36f8644dc178" + ], + "version": "==0.28.0" + }, + "google-cloud-language": { + "hashes": [ + "sha256:59e7c3ed0dcf54d17943cad29ececb41adbbfc1b56c9ba278c13fd17aea54188", + "sha256:b5c3073697b9c51b8f1a4a619f7b3b6744e88efe0e235958ff411ee17e825c61" + ], + "version": "==1.0.1" + }, + "google-cloud-logging": { + "hashes": [ + "sha256:81ff672f3b4c6f2a182282aae68f7c3dafbbfc8dc7dcc0db8dc90cd288adc3b8", + "sha256:a1567aa858fbe223973c698f12198e5828fa66f3d42dac27e81b246ff385cd70" + ], + "version": "==1.4.0" + }, + "google-cloud-monitoring": { + "hashes": [ + "sha256:534d66d97611c9c6e08823532f5144f6786d3a6103a6d5ed6411ac465faa5341", + "sha256:c7a336a469cf186e3621fe36bf0e4f291ea43a76b4a532b744a167d756a8170d" + ], + "version": "==0.28.1" + }, + "google-cloud-pubsub": { + "hashes": [ + "sha256:059dcd1862e07a47920474b0fe38d40508d8c4881929f17696a3aba834b11027", + "sha256:ff6e74390dfa097e3cee7d5f323aeed37a23dfb1faa762d9efced09f972415a4" + ], + "version": "==0.30.1" + }, + "google-cloud-resource-manager": { + "hashes": [ + "sha256:ed4eaab40164614db77496986fb2900d93cb1daa7e1a23fd20be7bd46705a8f3", + "sha256:fc29c11dcbe9208261d377185a1ae5331bab43f2a592222a25c8aca9c8031308" + ], + "version": "==0.28.1" + }, + "google-cloud-runtimeconfig": { + "hashes": [ + "sha256:095a1dab0d7b8e02dff06bee7844bb283a1c2c6f2e7333eb9896419a30143d82", + "sha256:f441fbc22e2d0871ecb390854aa352cf467d2751cbc0dac7578274ead813519e" + ], + "version": "==0.28.1" + }, + "google-cloud-spanner": { + "hashes": [ + "sha256:39707e37e2399df0a6ea7f5b636fc06858359a70af92ac485bbba9bf810a43e7", + "sha256:bc4c6269b07d0982289d4ecd9b88da943e097ab2104c79ce18e4966766bb877b" + ], + "version": "==0.29.0" + }, + "google-cloud-speech": { + "hashes": [ + "sha256:76e42ffdea4bb9790cac34d5a4cdb2e2d47a0e254a27dbbaf40fbd10fdb04e31", + "sha256:ea920710b2fa74175bacc1f90a2eb326038eeaf3ce364c29a40e7eb70c7c7132" + ], + "version": "==0.30.0" + }, + "google-cloud-storage": { + "hashes": [ + "sha256:5db85fa905f85377c5ea9ea0fb4c5602343d2ecc09395aa2efbf9a21d27233fc", + "sha256:939266b7d5c6df6d45a1aee2c47a09313f813e87790335f00c57708b49480054" + ], + "version": "==1.6.0" + }, + "google-cloud-trace": { + "hashes": [ + "sha256:b45bc7934ee459e83f1a4b04ba7a0de1be9fe004bcf494b9ff2f75e18414642c", + "sha256:c926f55c141caf9fd0e29991caaba03a6364fe997384e2f48c34051f0f690186" + ], + "version": "==0.17.0" + }, + "google-cloud-translate": { + "hashes": [ + "sha256:4420f5b320145bf097ca9a12b18ec27c067886e2832d181f268c46c3bcb0d2e4", + "sha256:7706814d8ee1be9668b5c204852d44e7f6c51d44a2822df772b7b2fa3fb7c6bb" + ], + "version": "==1.3.1" + }, + "google-cloud-videointelligence": { + "hashes": [ + "sha256:5c18e64bf41fc5f8203d3b4f7a88921ff8d6a09b8ce343da866274fa375dcb82", + "sha256:d46b94f8d37da565a90fb282a4053ee1379b4cbe1e2b51dfef75444fd5422e5d" + ], + "version": "==1.0.1" + }, + "google-cloud-vision": { + "hashes": [ + "sha256:9442d3456935654920f002efa846271dc68b19f5a0b3e2c314a9edd9f34f30a3", + "sha256:a4cd3f64ac2c2586a56ea00d27c58306465e3277873cc9bfce3677e9ccb2b039" + ], + "version": "==0.29.0" + }, + "google-gax": { + "hashes": [ + "sha256:518e8d5eb90774af2041080d242f4bcec4c6e653226c693901eaf82eda8a395c", + "sha256:bc60cdfed5c657ea8542ba8102fb43862a1c4809d98ca5aa1fcc92f9d4f7403d" + ], + "version": "==0.15.16" + }, + "google-resumable-media": { + "hashes": [ + "sha256:116de90b9cd483b17c53618ee6a5a20f33e741c648140c8cc9c2141e07616ff1", + "sha256:97de518f8166d442cc0b61fab308bcd319dbb970981e667ec8ded44f5ce49836" + ], + "version": "==0.3.1" + }, + "googleapis-common-protos": { + "hashes": [ + "sha256:c075eddaa2628ab519e01b7d75b76e66c40eaa50fc52758d8225f84708950ef2" + ], + "version": "==1.5.3" + }, + "grpc-google-iam-v1": { + "hashes": [ + "sha256:5009e831dcec22f3ff00e89405249d6a838d1449a46ac8224907aa5b0e0b1aec" + ], + "version": "==0.11.4" + }, + "grpcio": { + "hashes": [ + "sha256:022dc2a6d1537a5a16af4ccc3355ad7b512f9c627a1d5d579cd7c18830378bb3", + "sha256:025a591606b0aca13bec3e019d6acec01a39421f01b915b98a3a93ea0a53b412", + "sha256:03265472d39bf26f124c3ef68446f7873c8260893e6ae65b323a5b51ed52e580", + "sha256:10efe2e016c3ca7a370771ffcf1de9baa3456d4bccefde0f4ce3be091d871c8f", + "sha256:14bca481188c3f19135012aaff9abefa4e15529c7e1aca3084183d78094d06bd", + "sha256:17240d672b5c1c9ff22e52236c1870413b7fb5af762b97ce5a747a55e0a57e98", + "sha256:1bc36e512741f82c1d73f42df536aa2ab75d840f0d35c149b5d0bee1aed16862", + "sha256:224c513fbe0c3ca546870e5c21b08a8a56cd25795b76b3192ee9702a3344764b", + "sha256:2894466c499d9752e0d49ee8adc5ee12c676d86211fc1b292bf713cc7cfe9853", + "sha256:435b3bab2e34814666854eec203c77b169df1cd56cf22fe449cf5510af416e7d", + "sha256:4765600467d7cdb8f62a591d4427ddbeefcf4dbbe46e2f1b10af555e815ecbcb", + "sha256:4fa658a7e1ba5727ca066b1c8bb64c6befb98f2b8007f04a16c7c84555bf11b9", + "sha256:87e52924a99ac5935a468b3fe49c4b0090bd9b05470b55ed1192308791e6d332", + "sha256:88afda198adb0a9da52a66152062027a57877b46f59ffcf55acc3cbfaff77160", + "sha256:982439a872d41f969724efc139e0416ba45e0d7446e9a41fd2ebe19351adff9a", + "sha256:a1bc37c9910d0fbf4d9e80d5822f92c6e01e28dd1eb01323636ed19666b537cb", + "sha256:aa473b8276de39eeccc4ad6cbb7fd7feab0868180d72c0c93226033c79fa69b7", + "sha256:ae82bf2f7ceac6ba956e816120b4f66bda035571350e46b61bbdde1808aed1dd", + "sha256:b56e4f355c2499bb0bf8f8f4d0362b618b06afdfd2c10722710596dc7e295c6c", + "sha256:d2accc8e354f0ed5b337865260a78b3c6851d2fe3c0e1b025d437122cc15dd31", + "sha256:d410835e7554d064c2d99cfa0dd393ffbb0ccf52145ab51c725a8472ed254a3c", + "sha256:d9e3105f6de6cb759b028702bdd21cb36d27e010227669e43c675b9957a3c180", + "sha256:da306c80d69801a3e4115c448ed4ad481957d723ec1e00b99497c6661573c3e5", + "sha256:e579e4124d2a0931ce39639c60e0711918d6659b933eb97e67f60f84666ea488", + "sha256:e86639989c03831912fd9924beda26f6e9ffcc267656cea035bde9d88cf793b2", + "sha256:ea9564f58144e2f07995d57fb8e636be5efb084cd59c8651391ada2bb75dc0ff", + "sha256:f4a38071dd27f140cfe774f56aecdf0e33de926c21289cc9c7521ce8dd91fc1c" + ], + "version": "==1.10.0" + }, "happybase": { "hashes": [ "sha256:e20376e2e32291798d2226502994134c1c4e175136d8375b3c517a234fa22481" ], + "index": "pypi", "version": "==1.1.0" }, "happybase-mock": { @@ -40,27 +348,241 @@ "sha256:327203ff63171a83c9fab34b249636b6a55550041273d2acddc0723433bdf260", "sha256:bd4583551f40e8b7f622ffd462f8e7ed1d34d14d73fa1758f0a5f413b1949f50" ], + "index": "pypi", "version": "==0.9.0" }, - "nose": { + "httplib2": { "hashes": [ - "sha256:dadcddc0aefbf99eea214e0f1232b94f2fa9bd98fa8353711dacb112bfcbbb2a", - "sha256:9ff7c6cc443f8c51994b34a667bbcf45afd6d945be7477b52e97516fd17c53ac", - "sha256:f1bffef9cbc82628f6e7d7b40d7e255aefaa1adb6a1b1d26c69a8b79e6208a98" + "sha256:e71daed9a0e6373642db61166fa70beecc9bf04383477f84671348c02a04cbdf" ], - "version": "==1.3.7" + "version": "==0.11.3" + }, + "idna": { + "hashes": [ + "sha256:2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f", + "sha256:8c7309c718f94b3a625cb648ace320157ad16ff131ae0af362c9f21b80ef6ec4" + ], + "version": "==2.6" + }, + "jmespath": { + "hashes": [ + "sha256:6a81d4c9aa62caf061cb517b4d9ad1dd300374cd4706997aff9cd6aedd61fc64", + "sha256:f11b4461f425740a1d908e9a3f7365c3d2e569f6ca68a2ff8bc5bcd9676edd63" + ], + "version": "==0.9.3" + }, + "more-itertools": { + "hashes": [ + "sha256:0dd8f72eeab0d2c3bd489025bb2f6a1b8342f9b198f6fc37b52d15cfa4531fea", + "sha256:11a625025954c20145b37ff6309cd54e39ca94f72f6bb9576d1195db6fa2442e", + "sha256:c9ce7eccdcb901a2c75d326ea134e0886abfbea5f93e91cc95de9507c0816c44" + ], + "version": "==4.1.0" + }, + "mrjob": { + "hashes": [ + "sha256:669a98afe53f4e4ad9373445f91a8c26e86e30f1acc50c7fd274a42e1ea846d8", + "sha256:6ec1aca9b376c98249a324dd7837cc76e676d48ba10b2b6cbef246eba0ee52e9" + ], + "index": "pypi", + "version": "==0.6.2" + }, + "oauth2client": { + "hashes": [ + "sha256:5b5b056ec6f2304e7920b632885bd157fa71d1a7f3ddd00a43b1541a8d1a2460" + ], + "version": "==3.0.0" + }, + "pluggy": { + "hashes": [ + "sha256:7f8ae7f5bdf75671a718d2daf0a64b7885f74510bcd98b1a0bb420eb9a9d0cff" + ], + "version": "==0.6.0" }, "ply": { "hashes": [ - "sha256:096f9b8350b65ebd2fd1346b12452efe5b9607f7482813ffca50c22722a807ce", - "sha256:00c7c1aaa88358b9c765b6d3000c6eec0ba42abca5351b095321aef446081da3" + "sha256:e7d1bdff026beb159c9942f7a17e102c375638d9478a7ecd4cc0c76afd8de0b8" ], - "version": "==3.11" + "version": "==3.8" + }, + "proto-google-cloud-datastore-v1": { + "hashes": [ + "sha256:a431bb6a286107900c9ce3c48d316378867293c50a4d8a6c7393264600e916f9" + ], + "version": "==0.90.4" + }, + "proto-google-cloud-error-reporting-v1beta1": { + "hashes": [ + "sha256:526f49ae84dec16aa4740415c86a919d48206001d116d12df5badc5b2b051b82" + ], + "version": "==0.15.3" + }, + "proto-google-cloud-logging-v2": { + "hashes": [ + "sha256:e0538745f0f33760ffd5116f33385113835a3b2042a6c914923be0539e5280ce" + ], + "version": "==0.91.3" + }, + "protobuf": { + "hashes": [ + "sha256:01ccd6d03449ae75b779fb5bf4ed62177d61afe3c5e6465ccf3f8b2e1a84afbe", + "sha256:1d92cc30b0b46cced33adde5853d920179eb5ea8eecdee9552502a7f29cc3f21", + "sha256:242e4c7ae565267a8bc8b92d707177f915607ea4bd73244bec6cbf4a49b96661", + "sha256:3b60685732bd0cbdc802dfcb6071efbcf5d927ce3127c13c33ea1a8efae3aa76", + "sha256:3f655e1f99c3e14d56ca900af1b9a4715b691319a295cc38939d7f77eabd5e7c", + "sha256:560a38e692a69957a70ba0e5839aa67430efd63072bf91b0539dac19055694cd", + "sha256:5c1c8f6a0a68a874e3beff89255959dd80fad45870e96c88944a1b81a22dd5f5", + "sha256:628a3bf0794a8b3cabb18db11eb67cc10e0cc6e5525d557ae7b682bb73fa2018", + "sha256:7222d6616108b33ad6cbeff8117062a73c43cdc8fa8f64f6a322ebeb663e710e", + "sha256:76ef6ca3c50e4cfd044861586d5f1b352e0fe7f17f883df6c165bad5b4d0e10a", + "sha256:7c193e6964e752bd056735594826c5b03274ceb8f07349d3ae47d9766250ba96", + "sha256:869e12bcfb5759e683f53ec1dd6155b7be034065431da289f0cb4510040a0799", + "sha256:905414e5ea6cdb78d8730f66335755152b46685fcb9fc2f2134024e3ea9e8dcc", + "sha256:ac0067e3c60737865ed72bb7416e02297d229d960902802d874c0e167128c809", + "sha256:adf716a89c9cc1891ead79a861c427071ef59172f0e11967b00565a9547b3bd0", + "sha256:bcfa99f5a82f5eaaf6e5cee5bfdca5a1670f5740aec1d93dae170645ed1a16b0", + "sha256:cc94079ae6cbcea5ae194464a30f3223f075e06a0446f52bca9ddbeb6e9f412a", + "sha256:d5d9edfdc5a3a01d06062d677b121081629782edf0e05ca1be14f15bb947eeee", + "sha256:e269ab7a50bf0fa6fe6a88ea7dcc7a1079ae9450d9ab9b7730ac32916d55508b", + "sha256:e7fd33a3474cbe18fd5b5620784a0fa21fcae3e402b1806e29c6b450c7f61706" + ], + "version": "==3.5.2.post1" + }, + "psutil": { + "hashes": [ + "sha256:230eeb3aeb077814f3a2cd036ddb6e0f571960d327298cc914c02385c3e02a63", + "sha256:4152ae231709e3e8b80e26b6da20dc965a1a589959c48af1ed024eca6473f60d", + "sha256:779ec7e7621758ca11a8d99a1064996454b3570154277cc21342a01148a49c28", + "sha256:82a06785db8eeb637b349006cc28a92e40cd190fefae9875246d18d0de7ccac8", + "sha256:8a15d773203a1277e57b1d11a7ccdf70804744ef4a9518a87ab8436995c31a4b", + "sha256:94d4e63189f2593960e73acaaf96be235dd8a455fe2bcb37d8ad6f0e87f61556", + "sha256:a3286556d4d2f341108db65d8e20d0cd3fcb9a91741cb5eb496832d7daf2a97c", + "sha256:c91eee73eea00df5e62c741b380b7e5b6fdd553891bee5669817a3a38d036f13", + "sha256:e2467e9312c2fa191687b89ff4bc2ad8843be4af6fb4dc95a7cc5f7d7a327b18" + ], + "version": "==5.4.3" + }, + "py": { + "hashes": [ + "sha256:29c9fab495d7528e80ba1e343b958684f4ace687327e6f789a94bf3d1915f881", + "sha256:983f77f3331356039fdd792e9220b7b8ee1aa6bd2b25f567a963ff1de5a64f6a" + ], + "version": "==1.5.3" + }, + "pyasn1": { + "hashes": [ + "sha256:0d7f6e959fe53f3960a23d73f35e1fce61348b30915b6664309ca756de7c1f89", + "sha256:5a0db897b311d265cde49615cf783f1c78613138605cdd0f907ecfa5b2aba3ee", + "sha256:758cb50abddc03e4563fd9e7f03db56e3e87b58c0bd01247360326e5c0c7ffa5", + "sha256:7d626683e3d792cccc608da02498aff37ab4f3dafd8905d6bf755d11f9b26b43", + "sha256:a7efe807c4b83a859e2735c692b92ed7b567cfddc4163763412920041d876c2b", + "sha256:b5a9ca48055b9a20f6d1b3d68e38692e5431c86a0f99ea602e61294e891fee5b", + "sha256:c07d6e587b2f928366b1f67c09bda026a3e6fcc99e80a744dc67f8fca3895626", + "sha256:d258b0a71994f7770599835249cece1caef3c70def868c4915e6e5ca49b67d15", + "sha256:d5cd6ed995dba16fad0c521cfe31cd2d68400b53fcc2bce93326829be73ab6d1", + "sha256:d84c2aea3cf43780e9e6a19f4e4dddee9f6976519020e64e47c57e5c7a8c3dd2", + "sha256:e85895087905c65b5b594eb91f7522664c85545b147d5f4d4e7b1b07da8dcbdc", + "sha256:f81c96761fca60d64b1c9b79ec2e40cf9495a745cf570613079ef324aeb9672b" + ], + "version": "==0.4.2" + }, + "pyasn1-modules": { + "hashes": [ + "sha256:041e9fbafac548d095f5b6c3b328b80792f006196e15a232b731a83c93d59493", + "sha256:0cdca76a68dcb701fff58c397de0ef9922b472b1cb3ea9695ca19d03f1869787", + "sha256:0cea139045c38f84abaa803bcb4b5e8775ea12a42af10019d942f227acc426c3", + "sha256:0f2e50d20bc670be170966638fa0ae603f0bc9ed6ebe8e97a6d1d4cef30cc889", + "sha256:47fb6757ab78fe966e7c58b2030b546854f78416d653163f0ce9290cf2278e8b", + "sha256:598a6004ec26a8ab40a39ea955068cf2a3949ad9c0030da970f2e1ca4c9f1cc9", + "sha256:72fd8b0c11191da088147c6e4678ec53e573923ecf60b57eeac9e97433e09fc2", + "sha256:854700bbdd01394e2ada9c1bfbd0ed9f5d0c551350dbbd023e88b11d2771ae06", + "sha256:af00ea8f2022b6287dc375b2c70f31ab5af83989fc6fe9eacd4976ce26cd7ccc", + "sha256:b1f395cae2d669e0830cb023aa86f9f283b7a9aa32317d7f80d8e78aa2745812", + "sha256:c6747146e95d2b14cc2a8399b2b0bde3f93778f8f9ec704690d2b589c376c137", + "sha256:f53fe5bcebdf318f51399b250fe8325ef3a26d927f012cc0c8e0f9e9af7f9deb" + ], + "version": "==0.2.1" + }, + "pytest": { + "hashes": [ + "sha256:6266f87ab64692112e5477eba395cfedda53b1933ccd29478e671e73b420c19c", + "sha256:fae491d1874f199537fd5872b5e1f0e74a009b979df9d53d1553fd03da1703e1" + ], + "index": "pypi", + "version": "==3.5.0" + }, + "pytest-pythonpath": { + "hashes": [ + "sha256:f3d46b0a8276e856f7dc4f70ca97b88be6fbcf52d57ce36e35057d502388265e" + ], + "index": "pypi", + "version": "==0.7.2" + }, + "python-dateutil": { + "hashes": [ + "sha256:891c38b2a02f5bb1be3e4793866c8df49c7d19baabf9c1bad62547e0b4866aca", + "sha256:95511bae634d69bc7329ba55e646499a842bc4ec342ad54a8cdb65645a0aad3c" + ], + "version": "==2.6.1" + }, + "pytz": { + "hashes": [ + "sha256:07edfc3d4d2705a20a6e99d97f0c4b61c800b8232dc1c04d87e8554f130148dd", + "sha256:3a47ff71597f821cd84a162e71593004286e5be07a340fd462f0d33a760782b5", + "sha256:410bcd1d6409026fbaa65d9ed33bf6dd8b1e94a499e32168acfc7b332e4095c0", + "sha256:5bd55c744e6feaa4d599a6cbd8228b4f8f9ba96de2c38d56f08e534b3c9edf0d", + "sha256:61242a9abc626379574a166dc0e96a66cd7c3b27fc10868003fa210be4bff1c9", + "sha256:887ab5e5b32e4d0c86efddd3d055c1f363cbaa583beb8da5e22d2fa2f64d51ef", + "sha256:ba18e6a243b3625513d85239b3e49055a2f0318466e0b8a92b8fb8ca7ccdf55f", + "sha256:ed6509d9af298b7995d69a440e2822288f2eca1681b8cce37673dbb10091e5fe", + "sha256:f93ddcdd6342f94cea379c73cddb5724e0d6d0a1c91c9bdef364dc0368ba4fda" + ], + "version": "==2018.3" + }, + "pyyaml": { + "hashes": [ + "sha256:0c507b7f74b3d2dd4d1322ec8a94794927305ab4cebbe89cc47fe5e81541e6e8", + "sha256:16b20e970597e051997d90dc2cddc713a2876c47e3d92d59ee198700c5427736", + "sha256:3262c96a1ca437e7e4763e2843746588a965426550f3797a79fca9c6199c431f", + "sha256:326420cbb492172dec84b0f65c80942de6cedb5233c413dd824483989c000608", + "sha256:4474f8ea030b5127225b8894d626bb66c01cda098d47a2b0d3429b6700af9fd8", + "sha256:592766c6303207a20efc445587778322d7f73b161bd994f227adaa341ba212ab", + "sha256:5ac82e411044fb129bae5cfbeb3ba626acb2af31a8d17d175004b70862a741a7", + "sha256:5f84523c076ad14ff5e6c037fe1c89a7f73a3e04cf0377cb4d017014976433f3", + "sha256:827dc04b8fa7d07c44de11fabbc888e627fa8293b695e0f99cb544fdfa1bf0d1", + "sha256:b4c423ab23291d3945ac61346feeb9a0dc4184999ede5e7c43e1ffb975130ae6", + "sha256:bc6bced57f826ca7cb5125a10b23fd0f2fff3b7c4701d64c439a300ce665fff8", + "sha256:c01b880ec30b5a6e6aa67b09a2fe3fb30473008c85cd6a67359a1b15ed6d83a4", + "sha256:ca233c64c6e40eaa6c66ef97058cdc80e8d0157a443655baa1b2966e812807ca", + "sha256:e863072cdf4c72eebf179342c94e6989c67185842d9997960b3e69290b2fa269" + ], + "version": "==3.12" + }, + "requests": { + "hashes": [ + "sha256:6a1b267aa90cac58ac3a765d067950e7dbbf75b1da07e895d1f594193a40a38b", + "sha256:9c443e7324ba5b85070c4a818ade28bfabedf16ea10206da1132edaa6dda237e" + ], + "version": "==2.18.4" + }, + "rsa": { + "hashes": [ + "sha256:25df4e10c263fb88b5ace923dd84bf9aa7f5019687b5e55382ffcdb8bede9db5", + "sha256:43f682fea81c452c98d09fc316aae12de6d30c4b5c84226642cf8f8fd1c93abd" + ], + "version": "==3.4.2" + }, + "s3transfer": { + "hashes": [ + "sha256:90dc18e028989c609146e241ea153250be451e05ecc0c2832565231dacdf59c1", + "sha256:c7a9ec356982d5e9ab2d4b46391a7d6a950e2b04c472419f5fdec70cc0ada72f" + ], + "version": "==0.1.13" }, "six": { "hashes": [ - "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb", - "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9" + "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9", + "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb" ], "version": "==1.11.0" }, @@ -69,6 +591,13 @@ "sha256:309e57d97b5bfa01601393ad4f245451e989d6206a59279e56866b264a99796d" ], "version": "==0.3.9" + }, + "urllib3": { + "hashes": [ + "sha256:06330f386d6e4b195fbfc736b297f58c5a892e4440e54d294d7004e3a9bbea1b", + "sha256:cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f" + ], + "version": "==1.22" } }, "develop": {} diff --git a/backfill/backfill_hbase_from_cdx.py b/backfill/backfill_hbase_from_cdx.py new file mode 100755 index 0000000..757794a --- /dev/null +++ b/backfill/backfill_hbase_from_cdx.py @@ -0,0 +1,169 @@ +#!/usr/bin/env python3 +""" +Streaming Hadoop script to import CDX metadata into the HBase fulltext table, +primarily for URL-agnostic crawl de-duplication. Takes only "fulltext" file +formats. + +Requires: +- happybase + +TODO: +- argparse +- refactor into an object +- tests in separate file +- nose tests +- sentry integration for error reporting +""" + +import sys +import json +import happybase + +NORMAL_MIME = ( + 'application/pdf', + 'application/postscript', + 'text/html', + 'text/xml', + #'application/xml', +) + +def normalize_mime(raw): + raw = raw.lower() + for norm in NORMAL_MIME: + if raw.startswith(norm): + return norm + + # Special cases + if raw.startswith('application/xml'): + return 'text/xml' + if raw.startswith('application/x-pdf'): + return 'application/pdf' + return None + +def test_normalize_mime(): + assert normalize_mime("asdf") == None + assert normalize_mime("application/pdf") == "application/pdf" + assert normalize_mime("application/pdf+journal") == "application/pdf" + assert normalize_mime("Application/PDF") == "application/pdf" + assert normalize_mime("application/p") == None + assert normalize_mime("application/xml+stuff") == "text/xml" + +def transform_line(raw_cdx): + + cdx = raw_cdx.split() + if len(cdx) < 11: + return None + + surt = cdx[0] + dt = cdx[1] + url = cdx[2] + mime = normalize_mime(cdx[3]) + http_status = cdx[4] + if http_status != "200": + return None + key = cdx[5] + c_size = cdx[8] + offset = cdx[9] + warc = cdx[10] + info = dict(surt=surt, dt=dt, url=url, c_size=c_size, offset=offset, + warc=warc) + return {'key': key, 'file:mime': mime, 'file:cdx': info} + +def test_transform_line(): + + raw = "edu,upenn,ldc)/sites/www.ldc.upenn.edu/files/medar2009-large-arabic-broadcast-collection.pdf 20170828233154 https://www.ldc.upenn.edu/sites/www.ldc.upenn.edu/files/medar2009-large-arabic-broadcast-collection.pdf application/pdf 200 WL3FEA62TEU4F52Y5DOVQ62VET4QJW7G - - 210251 931661233 SEMSCHOLAR-PDF-CRAWL-2017-08-04-20170828231135742-00000-00009-wbgrp-svc284/SEMSCHOLAR-PDF-CRAWL-2017-08-04-20170828232253025-00005-3480~wbgrp-svc284.us.archive.org~8443.warc.gz" + correct = { + 'key': "WL3FEA62TEU4F52Y5DOVQ62VET4QJW7G", + 'file:mime': "application/pdf", + 'file:cdx': { + 'surt': "edu,upenn,ldc)/sites/www.ldc.upenn.edu/files/medar2009-large-arabic-broadcast-collection.pdf", + 'url': "https://www.ldc.upenn.edu/sites/www.ldc.upenn.edu/files/medar2009-large-arabic-broadcast-collection.pdf", + 'dt': "20170828233154", + 'warc': "SEMSCHOLAR-PDF-CRAWL-2017-08-04-20170828231135742-00000-00009-wbgrp-svc284/SEMSCHOLAR-PDF-CRAWL-2017-08-04-20170828232253025-00005-3480~wbgrp-svc284.us.archive.org~8443.warc.gz", + 'offset': "931661233", + 'c_size': "210251", + } + } + + assert transform_line(raw) == correct + assert transform_line(raw + "\n") == correct + assert transform_line(raw + " extra_field") == correct + + +def run(in_lines, out_lines, status_lines, table, mime_filter=None): + + if mime_filter is None: + mime_filter = ['application/pdf'] + count_skip = count_invalid = count_fail = count_success = 0 + + for raw_cdx in in_lines.readlines(): + if (raw_cdx.startswith(' ') or raw_cdx.startswith('filedesc') or + raw_cdx.startswith('#')): + # Skip line + count_skip += 1 + continue + + info = transform_line(raw_cdx) + if info is None: + count_invalid += 1 + continue + if info['file:mime'] not in mime_filter: + count_skip += 1 + continue + + key = info.pop('key') + info['file:cdx'] = json.dumps(info['file:cdx'], sort_keys=True, + indent=None) + try: + table.put(key, info) + count_success += 1 + except: + status_lines.write("ERROR\n") # TODO: + count_fail += 1 + + status_lines.write('\n') + status_lines.write('skip\t{}\n'.format(count_skip)) + status_lines.write('invalid\t{}\n'.format(count_invalid)) + status_lines.write('fail\t{}\n'.format(count_fail)) + status_lines.write('success\t{}\n'.format(count_success)) + + +def test_run(): + + import io + import happybase_mock + + out = io.StringIO() + status = io.StringIO() + raw = io.StringIO(""" +com,sagepub,cep)/content/28/9/960.full.pdf 20170705062200 http://cep.sagepub.com/content/28/9/960.full.pdf application/pdf 301 3I42H3S6NNFQ2MSVX7XZKYAYSCX5QBYJ - - 401 313356621 CITESEERX-CRAWL-2017-06-20-20170705061647307-00039-00048-wbgrp-svc284/CITESEERX-CRAWL-2017-06-20-20170705062052659-00043-31209~wbgrp-svc284.us.archive.org~8443.warc.gz +eu,eui,cadmus)/bitstream/handle/1814/36635/rscas_2015_03.pdf;jsessionid=761393014319a39f40d32ae3eb3a853f?sequence=1 20170705062202 http://cadmus.eui.eu/bitstream/handle/1814/36635/RSCAS_2015_03.pdf%3Bjsessionid%3D761393014319A39F40D32AE3EB3A853F?sequence%3D1 application/PDF 200 MPCXVWMUTRUGFP36SLPHKDLY6NGU4S3J - - 854156 328850624 CITESEERX-CRAWL-2017-06-20-20170705061647307-00039-00048-wbgrp-svc284/CITESEERX-CRAWL-2017-06-20-20170705062052659-00043-31209~wbgrp-svc284.us.archive.org~8443.warc.gz +com,pbworks,educ333b)/robots.txt 20170705063311 http://educ333b.pbworks.com/robots.txt text/plain 200 6VAUYENMOU2SK2OWNRPDD6WTQTECGZAD - - 638 398190140 CITESEERX-CRAWL-2017-06-20-20170705062707827-00049-00058-wbgrp-svc284/CITESEERX-CRAWL-2017-06-20-20170705063158203-00053-31209~wbgrp-svc284.us.archive.org~8443.warc.gz +""") + + conn = happybase_mock.Connection() + conn.create_table('wbgrp-journal-extract-test', {'file': {}, 'grobid0': {}}) + + table = conn.table('wbgrp-journal-extract-test') + run(raw, out, status, table) + + print(status.getvalue()) + + assert table.row(b'1') == {} + # HTTP 301 + assert table.row(b'3I42H3S6NNFQ2MSVX7XZKYAYSCX5QBYJ') == {} + # valid + assert table.row(b'MPCXVWMUTRUGFP36SLPHKDLY6NGU4S3J') != {} + # text/plain + assert table.row(b'6VAUYENMOU2SK2OWNRPDD6WTQTECGZAD') == {} + + row = table.row(b'MPCXVWMUTRUGFP36SLPHKDLY6NGU4S3J') + assert row[b'file:mime'] == b"application/pdf" + json.loads(row[b'file:cdx'].decode('utf-8')) + +if __name__=="__main__": + hb = happybase.Connection(host='') + with hb.connection() as conn: + table = conn.table('wbgrp-journal-extract-0-qa') + run(sys.stdin, sys.stdout, sys.stderr, table) + diff --git a/backfill/cdx_fulltext_to_hbase.py b/backfill/cdx_fulltext_to_hbase.py deleted file mode 100755 index 757794a..0000000 --- a/backfill/cdx_fulltext_to_hbase.py +++ /dev/null @@ -1,169 +0,0 @@ -#!/usr/bin/env python3 -""" -Streaming Hadoop script to import CDX metadata into the HBase fulltext table, -primarily for URL-agnostic crawl de-duplication. Takes only "fulltext" file -formats. - -Requires: -- happybase - -TODO: -- argparse -- refactor into an object -- tests in separate file -- nose tests -- sentry integration for error reporting -""" - -import sys -import json -import happybase - -NORMAL_MIME = ( - 'application/pdf', - 'application/postscript', - 'text/html', - 'text/xml', - #'application/xml', -) - -def normalize_mime(raw): - raw = raw.lower() - for norm in NORMAL_MIME: - if raw.startswith(norm): - return norm - - # Special cases - if raw.startswith('application/xml'): - return 'text/xml' - if raw.startswith('application/x-pdf'): - return 'application/pdf' - return None - -def test_normalize_mime(): - assert normalize_mime("asdf") == None - assert normalize_mime("application/pdf") == "application/pdf" - assert normalize_mime("application/pdf+journal") == "application/pdf" - assert normalize_mime("Application/PDF") == "application/pdf" - assert normalize_mime("application/p") == None - assert normalize_mime("application/xml+stuff") == "text/xml" - -def transform_line(raw_cdx): - - cdx = raw_cdx.split() - if len(cdx) < 11: - return None - - surt = cdx[0] - dt = cdx[1] - url = cdx[2] - mime = normalize_mime(cdx[3]) - http_status = cdx[4] - if http_status != "200": - return None - key = cdx[5] - c_size = cdx[8] - offset = cdx[9] - warc = cdx[10] - info = dict(surt=surt, dt=dt, url=url, c_size=c_size, offset=offset, - warc=warc) - return {'key': key, 'file:mime': mime, 'file:cdx': info} - -def test_transform_line(): - - raw = "edu,upenn,ldc)/sites/www.ldc.upenn.edu/files/medar2009-large-arabic-broadcast-collection.pdf 20170828233154 https://www.ldc.upenn.edu/sites/www.ldc.upenn.edu/files/medar2009-large-arabic-broadcast-collection.pdf application/pdf 200 WL3FEA62TEU4F52Y5DOVQ62VET4QJW7G - - 210251 931661233 SEMSCHOLAR-PDF-CRAWL-2017-08-04-20170828231135742-00000-00009-wbgrp-svc284/SEMSCHOLAR-PDF-CRAWL-2017-08-04-20170828232253025-00005-3480~wbgrp-svc284.us.archive.org~8443.warc.gz" - correct = { - 'key': "WL3FEA62TEU4F52Y5DOVQ62VET4QJW7G", - 'file:mime': "application/pdf", - 'file:cdx': { - 'surt': "edu,upenn,ldc)/sites/www.ldc.upenn.edu/files/medar2009-large-arabic-broadcast-collection.pdf", - 'url': "https://www.ldc.upenn.edu/sites/www.ldc.upenn.edu/files/medar2009-large-arabic-broadcast-collection.pdf", - 'dt': "20170828233154", - 'warc': "SEMSCHOLAR-PDF-CRAWL-2017-08-04-20170828231135742-00000-00009-wbgrp-svc284/SEMSCHOLAR-PDF-CRAWL-2017-08-04-20170828232253025-00005-3480~wbgrp-svc284.us.archive.org~8443.warc.gz", - 'offset': "931661233", - 'c_size': "210251", - } - } - - assert transform_line(raw) == correct - assert transform_line(raw + "\n") == correct - assert transform_line(raw + " extra_field") == correct - - -def run(in_lines, out_lines, status_lines, table, mime_filter=None): - - if mime_filter is None: - mime_filter = ['application/pdf'] - count_skip = count_invalid = count_fail = count_success = 0 - - for raw_cdx in in_lines.readlines(): - if (raw_cdx.startswith(' ') or raw_cdx.startswith('filedesc') or - raw_cdx.startswith('#')): - # Skip line - count_skip += 1 - continue - - info = transform_line(raw_cdx) - if info is None: - count_invalid += 1 - continue - if info['file:mime'] not in mime_filter: - count_skip += 1 - continue - - key = info.pop('key') - info['file:cdx'] = json.dumps(info['file:cdx'], sort_keys=True, - indent=None) - try: - table.put(key, info) - count_success += 1 - except: - status_lines.write("ERROR\n") # TODO: - count_fail += 1 - - status_lines.write('\n') - status_lines.write('skip\t{}\n'.format(count_skip)) - status_lines.write('invalid\t{}\n'.format(count_invalid)) - status_lines.write('fail\t{}\n'.format(count_fail)) - status_lines.write('success\t{}\n'.format(count_success)) - - -def test_run(): - - import io - import happybase_mock - - out = io.StringIO() - status = io.StringIO() - raw = io.StringIO(""" -com,sagepub,cep)/content/28/9/960.full.pdf 20170705062200 http://cep.sagepub.com/content/28/9/960.full.pdf application/pdf 301 3I42H3S6NNFQ2MSVX7XZKYAYSCX5QBYJ - - 401 313356621 CITESEERX-CRAWL-2017-06-20-20170705061647307-00039-00048-wbgrp-svc284/CITESEERX-CRAWL-2017-06-20-20170705062052659-00043-31209~wbgrp-svc284.us.archive.org~8443.warc.gz -eu,eui,cadmus)/bitstream/handle/1814/36635/rscas_2015_03.pdf;jsessionid=761393014319a39f40d32ae3eb3a853f?sequence=1 20170705062202 http://cadmus.eui.eu/bitstream/handle/1814/36635/RSCAS_2015_03.pdf%3Bjsessionid%3D761393014319A39F40D32AE3EB3A853F?sequence%3D1 application/PDF 200 MPCXVWMUTRUGFP36SLPHKDLY6NGU4S3J - - 854156 328850624 CITESEERX-CRAWL-2017-06-20-20170705061647307-00039-00048-wbgrp-svc284/CITESEERX-CRAWL-2017-06-20-20170705062052659-00043-31209~wbgrp-svc284.us.archive.org~8443.warc.gz -com,pbworks,educ333b)/robots.txt 20170705063311 http://educ333b.pbworks.com/robots.txt text/plain 200 6VAUYENMOU2SK2OWNRPDD6WTQTECGZAD - - 638 398190140 CITESEERX-CRAWL-2017-06-20-20170705062707827-00049-00058-wbgrp-svc284/CITESEERX-CRAWL-2017-06-20-20170705063158203-00053-31209~wbgrp-svc284.us.archive.org~8443.warc.gz -""") - - conn = happybase_mock.Connection() - conn.create_table('wbgrp-journal-extract-test', {'file': {}, 'grobid0': {}}) - - table = conn.table('wbgrp-journal-extract-test') - run(raw, out, status, table) - - print(status.getvalue()) - - assert table.row(b'1') == {} - # HTTP 301 - assert table.row(b'3I42H3S6NNFQ2MSVX7XZKYAYSCX5QBYJ') == {} - # valid - assert table.row(b'MPCXVWMUTRUGFP36SLPHKDLY6NGU4S3J') != {} - # text/plain - assert table.row(b'6VAUYENMOU2SK2OWNRPDD6WTQTECGZAD') == {} - - row = table.row(b'MPCXVWMUTRUGFP36SLPHKDLY6NGU4S3J') - assert row[b'file:mime'] == b"application/pdf" - json.loads(row[b'file:cdx'].decode('utf-8')) - -if __name__=="__main__": - hb = happybase.Connection(host='') - with hb.connection() as conn: - table = conn.table('wbgrp-journal-extract-0-qa') - run(sys.stdin, sys.stdout, sys.stderr, table) - diff --git a/backfill/pytest.ini b/backfill/pytest.ini new file mode 100644 index 0000000..0a5e921 --- /dev/null +++ b/backfill/pytest.ini @@ -0,0 +1,8 @@ + +[pytest] + +# allow imports from files in current directory +python_paths = . + +# search for 'test_*' functions in all python files, not just under tests +python_files = *.py -- cgit v1.2.3