Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 4 additions & 43 deletions jupyter/main-html-dedup/cc_dedup_fir.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@
"cell_type": "code",
"execution_count": null,
"id": "0",
"metadata": {
"execution": {
"iopub.execute_input": "2025-07-11T02:24:06.149493Z",
"iopub.status.busy": "2025-07-11T02:24:06.149207Z",
"iopub.status.idle": "2025-07-11T02:24:14.378413Z",
"shell.execute_reply": "2025-07-11T02:24:14.377755Z",
"shell.execute_reply.started": "2025-07-11T02:24:06.149476Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"from pyspark.sql import Row\n",
Expand Down Expand Up @@ -57,15 +49,7 @@
"cell_type": "code",
"execution_count": null,
"id": "2",
"metadata": {
"execution": {
"iopub.execute_input": "2025-07-11T02:24:14.379728Z",
"iopub.status.busy": "2025-07-11T02:24:14.379322Z",
"iopub.status.idle": "2025-07-11T02:24:14.382394Z",
"shell.execute_reply": "2025-07-11T02:24:14.381923Z",
"shell.execute_reply.started": "2025-07-11T02:24:14.379710Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"# 获取 cc warc path list\n",
Expand All @@ -81,13 +65,6 @@
"id": "3",
"metadata": {
"editable": true,
"execution": {
"iopub.execute_input": "2025-07-11T02:24:14.383374Z",
"iopub.status.busy": "2025-07-11T02:24:14.383061Z",
"iopub.status.idle": "2025-07-11T02:24:14.397134Z",
"shell.execute_reply": "2025-07-11T02:24:14.396661Z",
"shell.execute_reply.started": "2025-07-11T02:24:14.383359Z"
},
"slideshow": {
"slide_type": ""
},
Expand Down Expand Up @@ -185,15 +162,7 @@
"cell_type": "code",
"execution_count": null,
"id": "4",
"metadata": {
"execution": {
"iopub.execute_input": "2025-07-11T02:24:14.397836Z",
"iopub.status.busy": "2025-07-11T02:24:14.397698Z",
"iopub.status.idle": "2025-07-11T02:24:45.430826Z",
"shell.execute_reply": "2025-07-11T02:24:45.429906Z",
"shell.execute_reply.started": "2025-07-11T02:24:14.397823Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"# mapPartitions 对 warc path 并行解析数据\n",
Expand All @@ -217,15 +186,7 @@
"cell_type": "code",
"execution_count": null,
"id": "6",
"metadata": {
"execution": {
"iopub.execute_input": "2025-07-11T02:24:52.435257Z",
"iopub.status.busy": "2025-07-11T02:24:52.434949Z",
"iopub.status.idle": "2025-07-11T02:26:00.233117Z",
"shell.execute_reply": "2025-07-11T02:26:00.232529Z",
"shell.execute_reply.started": "2025-07-11T02:24:52.435240Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"config[\"skip_output_version\"] = True\n",
Expand Down
144 changes: 21 additions & 123 deletions jupyter/main-html-dedup/cc_dedup_sec.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@
"cell_type": "code",
"execution_count": null,
"id": "0",
"metadata": {
"execution": {
"iopub.status.idle": "2025-07-11T02:26:43.748017Z",
"shell.execute_reply": "2025-07-11T02:26:43.747366Z",
"shell.execute_reply.started": "2025-07-11T02:26:34.645411Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"from xinghe.spark import *\n",
Expand Down Expand Up @@ -50,15 +44,7 @@
"cell_type": "code",
"execution_count": null,
"id": "2",
"metadata": {
"execution": {
"iopub.execute_input": "2025-07-11T02:26:43.749268Z",
"iopub.status.busy": "2025-07-11T02:26:43.748929Z",
"iopub.status.idle": "2025-07-11T02:26:43.751756Z",
"shell.execute_reply": "2025-07-11T02:26:43.751304Z",
"shell.execute_reply.started": "2025-07-11T02:26:43.749250Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"#dump_paths = []\n",
Expand All @@ -71,15 +57,7 @@
"cell_type": "code",
"execution_count": null,
"id": "3",
"metadata": {
"execution": {
"iopub.execute_input": "2025-07-11T02:26:43.752632Z",
"iopub.status.busy": "2025-07-11T02:26:43.752346Z",
"iopub.status.idle": "2025-07-11T02:26:43.762655Z",
"shell.execute_reply": "2025-07-11T02:26:43.762229Z",
"shell.execute_reply.started": "2025-07-11T02:26:43.752617Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"#input_df = spark.read.format(\"json\").load(dump_paths)"
Expand All @@ -97,15 +75,7 @@
"cell_type": "code",
"execution_count": null,
"id": "5",
"metadata": {
"execution": {
"iopub.execute_input": "2025-07-11T02:26:43.763518Z",
"iopub.status.busy": "2025-07-11T02:26:43.763240Z",
"iopub.status.idle": "2025-07-11T02:26:43.770017Z",
"shell.execute_reply": "2025-07-11T02:26:43.769479Z",
"shell.execute_reply.started": "2025-07-11T02:26:43.763503Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"#already_exist_id_v_df = read_any_path(spark, already_exist_id_path, config)"
Expand All @@ -115,15 +85,7 @@
"cell_type": "code",
"execution_count": null,
"id": "6",
"metadata": {
"execution": {
"iopub.execute_input": "2025-07-11T02:26:43.772007Z",
"iopub.status.busy": "2025-07-11T02:26:43.771594Z",
"iopub.status.idle": "2025-07-11T02:26:43.776268Z",
"shell.execute_reply": "2025-07-11T02:26:43.775843Z",
"shell.execute_reply.started": "2025-07-11T02:26:43.771991Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"# 定义 Schema\n",
Expand All @@ -147,15 +109,7 @@
"cell_type": "code",
"execution_count": null,
"id": "8",
"metadata": {
"execution": {
"iopub.execute_input": "2025-07-11T02:26:43.776944Z",
"iopub.status.busy": "2025-07-11T02:26:43.776805Z",
"iopub.status.idle": "2025-07-11T02:26:43.784766Z",
"shell.execute_reply": "2025-07-11T02:26:43.784336Z",
"shell.execute_reply.started": "2025-07-11T02:26:43.776931Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"#join_df = input_df.join(already_exist_id_df, on=\"hash_html\", how=\"left\")\n",
Expand All @@ -173,16 +127,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "da837b3e-5eee-43b1-9c77-836aac1203df",
"metadata": {
"execution": {
"iopub.execute_input": "2025-07-11T02:26:43.785611Z",
"iopub.status.busy": "2025-07-11T02:26:43.785331Z",
"iopub.status.idle": "2025-07-11T02:27:13.606489Z",
"shell.execute_reply": "2025-07-11T02:27:13.605744Z",
"shell.execute_reply.started": "2025-07-11T02:26:43.785596Z"
}
},
"id": "10",
"metadata": {},
"outputs": [],
"source": [
"input_df = read_any_path(spark, \",\".join(base_input_path), config)"
Expand All @@ -191,16 +137,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "20135ae2-b1d0-43c9-b241-8d23de94f01d",
"metadata": {
"execution": {
"iopub.execute_input": "2025-07-11T02:27:13.608658Z",
"iopub.status.busy": "2025-07-11T02:27:13.607902Z",
"iopub.status.idle": "2025-07-11T02:27:13.612633Z",
"shell.execute_reply": "2025-07-11T02:27:13.611707Z",
"shell.execute_reply.started": "2025-07-11T02:27:13.608633Z"
}
},
"id": "11",
"metadata": {},
"outputs": [],
"source": [
"def json_data(row_iter)->Row:\n",
Expand All @@ -212,16 +150,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "0c0435c3-bd5e-4571-ab29-90c522023dec",
"metadata": {
"execution": {
"iopub.execute_input": "2025-07-11T02:27:13.614260Z",
"iopub.status.busy": "2025-07-11T02:27:13.613866Z",
"iopub.status.idle": "2025-07-11T02:27:17.465595Z",
"shell.execute_reply": "2025-07-11T02:27:17.464788Z",
"shell.execute_reply.started": "2025-07-11T02:27:13.614237Z"
}
},
"id": "12",
"metadata": {},
"outputs": [],
"source": [
"undedup_id_df = input_df.rdd.mapPartitions(json_data).toDF()"
Expand All @@ -230,16 +160,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "10",
"metadata": {
"execution": {
"iopub.execute_input": "2025-07-11T02:27:17.466995Z",
"iopub.status.busy": "2025-07-11T02:27:17.466683Z",
"iopub.status.idle": "2025-07-11T02:27:17.526987Z",
"shell.execute_reply": "2025-07-11T02:27:17.526167Z",
"shell.execute_reply.started": "2025-07-11T02:27:17.466977Z"
}
},
"id": "13",
"metadata": {},
"outputs": [],
"source": [
"def deduplicate_partition(partition):\n",
Expand All @@ -251,24 +173,16 @@
{
"cell_type": "code",
"execution_count": null,
"id": "11",
"metadata": {
"execution": {
"iopub.execute_input": "2025-07-11T02:27:17.528440Z",
"iopub.status.busy": "2025-07-11T02:27:17.528025Z",
"iopub.status.idle": "2025-07-11T02:27:17.537970Z",
"shell.execute_reply": "2025-07-11T02:27:17.537362Z",
"shell.execute_reply.started": "2025-07-11T02:27:17.528418Z"
}
},
"id": "14",
"metadata": {},
"outputs": [],
"source": [
"dedup_df = dedup_part_df.dropDuplicates([\"hash_html\"])"
]
},
{
"cell_type": "markdown",
"id": "12",
"id": "15",
"metadata": {},
"source": [
"# 写出s3"
Expand All @@ -277,16 +191,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "13",
"metadata": {
"execution": {
"iopub.execute_input": "2025-07-11T02:27:17.539280Z",
"iopub.status.busy": "2025-07-11T02:27:17.539112Z",
"iopub.status.idle": "2025-07-11T02:27:17.581417Z",
"shell.execute_reply": "2025-07-11T02:27:17.580614Z",
"shell.execute_reply.started": "2025-07-11T02:27:17.539264Z"
}
},
"id": "16",
"metadata": {},
"outputs": [],
"source": [
"struct_col = struct(dedup_df[\"track_id\"],dedup_df[\"sub_path\"],dedup_df[\"hash_html\"],)\n",
Expand All @@ -296,16 +202,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "14",
"metadata": {
"execution": {
"iopub.execute_input": "2025-07-11T02:27:17.582756Z",
"iopub.status.busy": "2025-07-11T02:27:17.582439Z",
"iopub.status.idle": "2025-07-11T02:28:54.423589Z",
"shell.execute_reply": "2025-07-11T02:28:54.422850Z",
"shell.execute_reply.started": "2025-07-11T02:27:17.582737Z"
}
},
"id": "17",
"metadata": {},
"outputs": [],
"source": [
"config[\"skip_output_version\"] = True\n",
Expand Down
Loading