Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 501af1c

Browse files
committed
feat: rename job_history API to execution_history
1 parent 8d3b0c5 commit 501af1c

File tree

4 files changed

+69
-58
lines changed

4 files changed

+69
-58
lines changed

bigframes/pandas/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -422,11 +422,13 @@ def reset_session():
422422
reset_session.__doc__ = global_session.close_session.__doc__
423423

424424

425-
def job_history() -> pandas.DataFrame:
426-
return global_session.with_default_session(bigframes.session.Session.job_history)
425+
def execution_history() -> pandas.DataFrame:
426+
return global_session.with_default_session(
427+
bigframes.session.Session.execution_history
428+
)
427429

428430

429-
job_history.__doc__ = inspect.getdoc(bigframes.session.Session.job_history)
431+
execution_history.__doc__ = inspect.getdoc(bigframes.session.Session.execution_history)
430432

431433

432434
# SQL Compilation uses recursive algorithms on deep trees
@@ -452,7 +454,7 @@ def job_history() -> pandas.DataFrame:
452454
deploy_remote_function,
453455
deploy_udf,
454456
get_default_session_id,
455-
job_history,
457+
execution_history,
456458
get_dummies,
457459
merge,
458460
qcut,
@@ -488,7 +490,7 @@ def job_history() -> pandas.DataFrame:
488490
"deploy_remote_function",
489491
"deploy_udf",
490492
"get_default_session_id",
491-
"job_history",
493+
"execution_history",
492494
"get_dummies",
493495
"merge",
494496
"qcut",

bigframes/session/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,8 @@ def slot_millis_sum(self):
371371
"""The sum of all slot time used by bigquery jobs in this session."""
372372
return self._metrics.slot_millis
373373

374-
def job_history(self) -> pandas.DataFrame:
375-
"""Returns a list of BigQuery jobs initiated by BigFrames in the current session."""
374+
def execution_history(self) -> pandas.DataFrame:
375+
"""Returns a list of underlying BigQuery executions initiated by BigFrames in the current session."""
376376
return pandas.DataFrame([job.__dict__ for job in self._metrics.jobs])
377377

378378
@property
Lines changed: 53 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,117 @@
11
{
22
"cells": [
33
{
4+
"id": "e19aa997",
45
"cell_type": "markdown",
5-
"metadata": {},
66
"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
1111
},
1212
{
13+
"id": "84d3ccf6",
1314
"cell_type": "code",
14-
"execution_count": null,
15-
"metadata": {},
16-
"outputs": [],
1715
"source": [
1816
"import pandas as pd\n",
1917
"import bigframes.pandas as bpd\n",
2018
"\n",
2119
"# Set options if needed, e.g. project/location\\n\n",
2220
"# bpd.options.bigquery.project = \"YOUR_PROJECT\"\\n\n",
2321
"# bpd.options.bigquery.location = \"US\""
24-
]
22+
],
23+
"metadata": {},
24+
"execution_count": null
2525
},
2626
{
27+
"id": "4a473c4c",
2728
"cell_type": "markdown",
28-
"metadata": {},
2929
"source": [
3030
"## 1. Trigger a Query Job (read_gbq)"
31-
]
31+
],
32+
"metadata": {},
33+
"execution_count": null
3234
},
3335
{
36+
"id": "e3b5ee75",
3437
"cell_type": "code",
35-
"execution_count": null,
36-
"metadata": {},
37-
"outputs": [],
3838
"source": [
3939
"df = bpd.read_gbq(\"SELECT 1 as a, 2 as b\")\n",
4040
"df.head()"
41-
]
41+
],
42+
"metadata": {},
43+
"execution_count": null
4244
},
4345
{
46+
"id": "e20ed8e4",
4447
"cell_type": "markdown",
45-
"metadata": {},
4648
"source": [
4749
"## 2. Trigger a Load Job (read_pandas)"
48-
]
50+
],
51+
"metadata": {},
52+
"execution_count": null
4953
},
5054
{
55+
"id": "0395b687",
5156
"cell_type": "code",
52-
"execution_count": null,
53-
"metadata": {},
54-
"outputs": [],
5557
"source": [
5658
"local_df = pd.DataFrame({'col1': [1, 2, 3], 'col2': ['a', 'b', 'c']})\n",
5759
"bf_df = bpd.read_pandas(local_df)\n",
5860
"bf_df.head()"
59-
]
61+
],
62+
"metadata": {},
63+
"execution_count": null
6064
},
6165
{
66+
"id": "59562434",
6267
"cell_type": "markdown",
63-
"metadata": {},
6468
"source": [
6569
"## 3. Trigger a Computation (Computation Job)"
66-
]
70+
],
71+
"metadata": {},
72+
"execution_count": null
6773
},
6874
{
75+
"id": "f37ef68a",
6976
"cell_type": "code",
70-
"execution_count": null,
71-
"metadata": {},
72-
"outputs": [],
7377
"source": [
7478
"# Perform a simple aggregation to trigger a computation\\n\n",
7579
"agg_df = bf_df.groupby('col2').sum()\n",
7680
"agg_df.head()"
77-
]
81+
],
82+
"metadata": {},
83+
"execution_count": null
7884
},
7985
{
86+
"id": "836660ec",
8087
"cell_type": "markdown",
81-
"metadata": {},
8288
"source": [
83-
"## 4. Check Job History"
84-
]
89+
"## 4. Check Execution History"
90+
],
91+
"metadata": {},
92+
"execution_count": null
8593
},
8694
{
95+
"id": "73b3754f",
8796
"cell_type": "code",
88-
"execution_count": null,
89-
"metadata": {},
90-
"outputs": [],
9197
"source": [
92-
"history = bpd.job_history()\n",
93-
"history"
94-
]
98+
"history = bpd.execution_history()\\nhistory"
99+
],
100+
"metadata": {},
101+
"execution_count": null
95102
},
96103
{
104+
"id": "bf380f88",
97105
"cell_type": "markdown",
98-
"metadata": {},
99106
"source": [
100107
"### Verify Specific Columns"
101-
]
108+
],
109+
"metadata": {},
110+
"execution_count": null
102111
},
103112
{
113+
"id": "a6a545e7",
104114
"cell_type": "code",
105-
"execution_count": null,
106-
"metadata": {},
107-
"outputs": [],
108115
"source": [
109116
"# Display key columns to verify data population\\n\n",
110117
"cols_to_check = [\n",
@@ -121,7 +128,9 @@
121128
"# Filter columns that exist in the history DataFrame\n",
122129
"existing_cols = [col for col in cols_to_check if col in history.columns]\n",
123130
"history[existing_cols]"
124-
]
131+
],
132+
"metadata": {},
133+
"execution_count": null
125134
}
126135
],
127136
"metadata": {
@@ -143,6 +152,6 @@
143152
"version": "3.8.5"
144153
}
145154
},
146-
"nbformat": 4,
147-
"nbformat_minor": 4
155+
"nbformat_minor": 4,
156+
"nbformat": 4
148157
}

tests/unit/session/test_job_history.py renamed to tests/unit/session/test_execution_history.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
NOW = datetime.datetime.now(datetime.timezone.utc)
2626

2727

28-
def test_pandas_job_history(monkeypatch):
28+
def test_pandas_execution_history(monkeypatch):
2929
query_job = unittest.mock.create_autospec(bigquery.QueryJob, instance=True)
3030
query_job.job_id = "job_pandas"
3131
query_job.location = "US"
@@ -60,14 +60,14 @@ def test_pandas_job_history(monkeypatch):
6060

6161
session._metrics.count_job_stats(query_job=query_job)
6262

63-
df = bpd.job_history()
63+
df = bpd.execution_history()
6464

6565
assert isinstance(df, pandas.DataFrame)
6666
assert len(df) == 1
6767
assert df.iloc[0]["job_id"] == "job_pandas"
6868

6969

70-
def test_session_job_history():
70+
def test_session_execution_history():
7171
query_job = unittest.mock.create_autospec(bigquery.QueryJob, instance=True)
7272
query_job.job_id = "job1"
7373
query_job.location = "US"
@@ -98,7 +98,7 @@ def test_session_job_history():
9898
session = bigframes.session.Session(clients_provider=clients_provider)
9999
session._metrics.count_job_stats(query_job=query_job)
100100

101-
df = session.job_history()
101+
df = session.execution_history()
102102

103103
assert isinstance(df, pandas.DataFrame)
104104
assert len(df) == 1
@@ -107,7 +107,7 @@ def test_session_job_history():
107107
assert "creation_time" in df.columns
108108

109109

110-
def test_job_history_with_query_job():
110+
def test_execution_history_with_query_job():
111111
query_job = unittest.mock.create_autospec(bigquery.QueryJob, instance=True)
112112
query_job.job_id = "job1"
113113
query_job.location = "US"
@@ -134,7 +134,7 @@ def test_job_history_with_query_job():
134134
assert job.duration_seconds == 3.0
135135

136136

137-
def test_job_history_with_row_iterator():
137+
def test_execution_history_with_row_iterator():
138138
row_iterator = unittest.mock.create_autospec(
139139
bigquery.table.RowIterator, instance=True
140140
)
@@ -161,7 +161,7 @@ def test_job_history_with_row_iterator():
161161
assert job.duration_seconds == 2.0
162162

163163

164-
def test_job_history_with_load_job():
164+
def test_execution_history_with_load_job():
165165
load_job = unittest.mock.create_autospec(bigquery.LoadJob, instance=True)
166166
load_job.job_id = "job3"
167167
load_job.location = "US"

0 commit comments

Comments
 (0)