MCPcopy Create free account
hub / github.com/apple/axlearn / execute

Method execute

axlearn/cloud/common/job.py:115–132  ·  view source on GitHub ↗

Wraps _execute with retries. All args and kwargs are forwarded. Retries are triggered automatically when _execute throws an exception. If all retries are exhausted, _delete is invoked to cleanup the job.

(self)

Source from the content-addressed store, hash-verified

113
114 # TODO(markblee): Expand the API to include create/delete/start/stop.
115 def execute(self) -> Any:
116 """Wraps _execute with retries. All args and kwargs are forwarded.
117
118 Retries are triggered automatically when _execute throws an exception.
119 If all retries are exhausted, _delete is invoked to cleanup the job.
120 """
121 cfg = self.config
122
123 try:
124 return _with_retry(
125 self._execute,
126 interval=cfg.retry_interval,
127 max_tries=cfg.max_tries,
128 )
129 except Exception: # pylint: disable=broad-except
130 # Cleanup on unexpected failure or exhausted retries.
131 self._delete()
132 raise
133
134
135# TODO(markblee): Consider adding exponential backoff.

Callers 5

test_executeMethod · 0.45
test_exceptionMethod · 0.45
create_custom_metricFunction · 0.45
write_time_series_metricFunction · 0.45

Calls 2

_deleteMethod · 0.95
_with_retryFunction · 0.85

Tested by 3

test_executeMethod · 0.36
test_exceptionMethod · 0.36