|
1 | 1 | { |
2 | 2 | "cells": [ |
3 | 3 | { |
| 4 | + "id": "e19aa997", |
4 | 5 | "cell_type": "markdown", |
5 | | - "metadata": {}, |
6 | 6 | "source": [ |
7 | | - "# Job History Manual Test\n", |
8 | | - "\n", |
9 | | - "This notebook demonstrates and manually tests the `bigframes.pandas.job_history()` functionality." |
10 | | - ] |
| 7 | + "# Execution History Manual Test\\n\\nThis notebook demonstrates and manually tests the `bigframes.pandas.execution_history()` functionality." |
| 8 | + ], |
| 9 | + "metadata": {}, |
| 10 | + "execution_count": null |
11 | 11 | }, |
12 | 12 | { |
| 13 | + "id": "84d3ccf6", |
13 | 14 | "cell_type": "code", |
14 | | - "execution_count": null, |
15 | | - "metadata": {}, |
16 | | - "outputs": [], |
17 | 15 | "source": [ |
18 | 16 | "import pandas as pd\n", |
19 | 17 | "import bigframes.pandas as bpd\n", |
20 | 18 | "\n", |
21 | 19 | "# Set options if needed, e.g. project/location\\n\n", |
22 | 20 | "# bpd.options.bigquery.project = \"YOUR_PROJECT\"\\n\n", |
23 | 21 | "# bpd.options.bigquery.location = \"US\"" |
24 | | - ] |
| 22 | + ], |
| 23 | + "metadata": {}, |
| 24 | + "execution_count": null |
25 | 25 | }, |
26 | 26 | { |
| 27 | + "id": "4a473c4c", |
27 | 28 | "cell_type": "markdown", |
28 | | - "metadata": {}, |
29 | 29 | "source": [ |
30 | 30 | "## 1. Trigger a Query Job (read_gbq)" |
31 | | - ] |
| 31 | + ], |
| 32 | + "metadata": {}, |
| 33 | + "execution_count": null |
32 | 34 | }, |
33 | 35 | { |
| 36 | + "id": "e3b5ee75", |
34 | 37 | "cell_type": "code", |
35 | | - "execution_count": null, |
36 | | - "metadata": {}, |
37 | | - "outputs": [], |
38 | 38 | "source": [ |
39 | 39 | "df = bpd.read_gbq(\"SELECT 1 as a, 2 as b\")\n", |
40 | 40 | "df.head()" |
41 | | - ] |
| 41 | + ], |
| 42 | + "metadata": {}, |
| 43 | + "execution_count": null |
42 | 44 | }, |
43 | 45 | { |
| 46 | + "id": "e20ed8e4", |
44 | 47 | "cell_type": "markdown", |
45 | | - "metadata": {}, |
46 | 48 | "source": [ |
47 | 49 | "## 2. Trigger a Load Job (read_pandas)" |
48 | | - ] |
| 50 | + ], |
| 51 | + "metadata": {}, |
| 52 | + "execution_count": null |
49 | 53 | }, |
50 | 54 | { |
| 55 | + "id": "0395b687", |
51 | 56 | "cell_type": "code", |
52 | | - "execution_count": null, |
53 | | - "metadata": {}, |
54 | | - "outputs": [], |
55 | 57 | "source": [ |
56 | 58 | "local_df = pd.DataFrame({'col1': [1, 2, 3], 'col2': ['a', 'b', 'c']})\n", |
57 | 59 | "bf_df = bpd.read_pandas(local_df)\n", |
58 | 60 | "bf_df.head()" |
59 | | - ] |
| 61 | + ], |
| 62 | + "metadata": {}, |
| 63 | + "execution_count": null |
60 | 64 | }, |
61 | 65 | { |
| 66 | + "id": "59562434", |
62 | 67 | "cell_type": "markdown", |
63 | | - "metadata": {}, |
64 | 68 | "source": [ |
65 | 69 | "## 3. Trigger a Computation (Computation Job)" |
66 | | - ] |
| 70 | + ], |
| 71 | + "metadata": {}, |
| 72 | + "execution_count": null |
67 | 73 | }, |
68 | 74 | { |
| 75 | + "id": "f37ef68a", |
69 | 76 | "cell_type": "code", |
70 | | - "execution_count": null, |
71 | | - "metadata": {}, |
72 | | - "outputs": [], |
73 | 77 | "source": [ |
74 | 78 | "# Perform a simple aggregation to trigger a computation\\n\n", |
75 | 79 | "agg_df = bf_df.groupby('col2').sum()\n", |
76 | 80 | "agg_df.head()" |
77 | | - ] |
| 81 | + ], |
| 82 | + "metadata": {}, |
| 83 | + "execution_count": null |
78 | 84 | }, |
79 | 85 | { |
| 86 | + "id": "836660ec", |
80 | 87 | "cell_type": "markdown", |
81 | | - "metadata": {}, |
82 | 88 | "source": [ |
83 | | - "## 4. Check Job History" |
84 | | - ] |
| 89 | + "## 4. Check Execution History" |
| 90 | + ], |
| 91 | + "metadata": {}, |
| 92 | + "execution_count": null |
85 | 93 | }, |
86 | 94 | { |
| 95 | + "id": "73b3754f", |
87 | 96 | "cell_type": "code", |
88 | | - "execution_count": null, |
89 | | - "metadata": {}, |
90 | | - "outputs": [], |
91 | 97 | "source": [ |
92 | | - "history = bpd.job_history()\n", |
93 | | - "history" |
94 | | - ] |
| 98 | + "history = bpd.execution_history()\\nhistory" |
| 99 | + ], |
| 100 | + "metadata": {}, |
| 101 | + "execution_count": null |
95 | 102 | }, |
96 | 103 | { |
| 104 | + "id": "bf380f88", |
97 | 105 | "cell_type": "markdown", |
98 | | - "metadata": {}, |
99 | 106 | "source": [ |
100 | 107 | "### Verify Specific Columns" |
101 | | - ] |
| 108 | + ], |
| 109 | + "metadata": {}, |
| 110 | + "execution_count": null |
102 | 111 | }, |
103 | 112 | { |
| 113 | + "id": "a6a545e7", |
104 | 114 | "cell_type": "code", |
105 | | - "execution_count": null, |
106 | | - "metadata": {}, |
107 | | - "outputs": [], |
108 | 115 | "source": [ |
109 | 116 | "# Display key columns to verify data population\\n\n", |
110 | 117 | "cols_to_check = [\n", |
|
121 | 128 | "# Filter columns that exist in the history DataFrame\n", |
122 | 129 | "existing_cols = [col for col in cols_to_check if col in history.columns]\n", |
123 | 130 | "history[existing_cols]" |
124 | | - ] |
| 131 | + ], |
| 132 | + "metadata": {}, |
| 133 | + "execution_count": null |
125 | 134 | } |
126 | 135 | ], |
127 | 136 | "metadata": { |
|
143 | 152 | "version": "3.8.5" |
144 | 153 | } |
145 | 154 | }, |
146 | | - "nbformat": 4, |
147 | | - "nbformat_minor": 4 |
| 155 | + "nbformat_minor": 4, |
| 156 | + "nbformat": 4 |
148 | 157 | } |
0 commit comments