Skip to content

Commit aea67a5

Browse files
committed
build: expose savedmodel loader headers on android
1 parent a733916 commit aea67a5

2 files changed

Lines changed: 58 additions & 26 deletions

File tree

scripts/patch_tfjava.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,26 @@ def patch_workspace(path: Path) -> None:
12931293
"""
12941294

12951295

1296+
TF_C_API_SAVED_MODEL_INCLUDE_PATCH = """--- a/tensorflow/c/c_api.cc
1297+
+++ b/tensorflow/c/c_api.cc
1298+
@@ -29,11 +29,13 @@ limitations under the License.
1299+
#include "tensorflow/cc/framework/ops.h"
1300+
#include "tensorflow/cc/framework/scope_internal.h"
1301+
#include "tensorflow/cc/ops/while_loop.h"
1302+
-#include "tensorflow/cc/saved_model/loader.h"
1303+
#include "tensorflow/core/distributed_runtime/server_lib.h"
1304+
#include "tensorflow/core/framework/logging.h"
1305+
#include "tensorflow/core/framework/op_gen_lib.h"
1306+
#endif // !defined(IS_MOBILE_PLATFORM) && !defined(IS_SLIM_BUILD)
1307+
+#if !defined(IS_SLIM_BUILD)
1308+
+#include "tensorflow/cc/saved_model/loader.h"
1309+
+#endif // !defined(IS_SLIM_BUILD)
1310+
#include "tensorflow/c/c_api_internal.h"
1311+
#include "tensorflow/c/tf_status_internal.h"
1312+
#include "tensorflow/c/tf_tensor.h"
1313+
"""
1314+
1315+
12961316
TF_C_API_SAVED_MODEL_ANDROID_PATCH = """--- a/tensorflow/c/c_api.cc
12971317
+++ b/tensorflow/c/c_api.cc
12981318
@@ -2189,11 +2189,11 @@
@@ -1520,6 +1540,7 @@ def write_tensorflow_android_absl_patch(path: Path) -> None:
15201540
text += GRPC_SERVER_LIB_ANDROID_BUILD_PATCH
15211541
text += GRPC_SERVER_LIB_ANDROID_CC_PATCH
15221542
text += TF_C_API_EXPERIMENTAL_CC_PATCH
1543+
text += TF_C_API_SAVED_MODEL_INCLUDE_PATCH
15231544
text += TF_C_API_SAVED_MODEL_ANDROID_PATCH
15241545
text += SAVED_MODEL_ANDROID_LOADER_PATCH
15251546
text += TENSORFLOW_FRAMEWORK_ANDROID_PATCH

scripts/wait_for_github_action.py

Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ def main() -> int:
171171

172172
start = time.monotonic()
173173
announced_waiting_for_run = False
174+
last_error: str | None = None
174175
last_status: str | None = None
175176
target_run_id = args.run_id
176177

@@ -180,32 +181,42 @@ def main() -> int:
180181
return 124
181182

182183
run: dict[str, Any] | None
183-
if target_run_id is not None:
184-
run = fetch_run_by_id(args.repo, target_run_id)
185-
else:
186-
run = find_matching_run(
187-
args.repo,
188-
commit=args.commit,
189-
branch=args.branch,
190-
workflow=args.workflow,
191-
event=args.event,
192-
)
193-
if run is None:
194-
if not announced_waiting_for_run:
195-
print(
196-
"waiting for matching run: repo={repo} commit={commit} branch={branch} workflow={workflow} event={event}".format(
197-
repo=args.repo,
198-
commit=args.commit or "",
199-
branch=args.branch or "",
200-
workflow=args.workflow or "",
201-
event=args.event or "",
202-
),
203-
flush=True,
204-
)
205-
announced_waiting_for_run = True
206-
time.sleep(args.interval)
207-
continue
208-
target_run_id = int(run["databaseId"])
184+
try:
185+
if target_run_id is not None:
186+
run = fetch_run_by_id(args.repo, target_run_id)
187+
else:
188+
run = find_matching_run(
189+
args.repo,
190+
commit=args.commit,
191+
branch=args.branch,
192+
workflow=args.workflow,
193+
event=args.event,
194+
)
195+
if run is None:
196+
if not announced_waiting_for_run:
197+
print(
198+
"waiting for matching run: repo={repo} commit={commit} branch={branch} workflow={workflow} event={event}".format(
199+
repo=args.repo,
200+
commit=args.commit or "",
201+
branch=args.branch or "",
202+
workflow=args.workflow or "",
203+
event=args.event or "",
204+
),
205+
flush=True,
206+
)
207+
announced_waiting_for_run = True
208+
time.sleep(args.interval)
209+
continue
210+
target_run_id = int(run["databaseId"])
211+
except RuntimeError as exc:
212+
message = str(exc)
213+
if message != last_error:
214+
print(f"transient gh error, retrying: {message}", file=sys.stderr, flush=True)
215+
last_error = message
216+
time.sleep(args.interval)
217+
continue
218+
219+
last_error = None
209220

210221
status = run["status"]
211222
if status != last_status:

0 commit comments

Comments
 (0)