Skip to content

Commit

Permalink
Update abstra-lib
Browse files Browse the repository at this point in the history
  • Loading branch information
abstra-bot committed Nov 8, 2024
1 parent 23b5e94 commit 74dcc10
Show file tree
Hide file tree
Showing 227 changed files with 475 additions and 465 deletions.
32 changes: 21 additions & 11 deletions abstra_internals/controllers/execution_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class NonCleanExit(Exception):
pass


# should be smaller than the RabbitMQ consumer timeout (24h now)
PROCESS_TIMEOUT = 6 * 60 * 60


def PreExecController(
*,
controller: MainController,
Expand Down Expand Up @@ -49,16 +53,19 @@ def PreExecController(
)

p.start()
p.join()
p.join(timeout=PROCESS_TIMEOUT)
consumer.done_callback(msg)

if p.is_alive():
p.terminate()
raise NonCleanExit(f"Worker took too long to complete ({PROCESS_TIMEOUT})")

if p.exitcode != 0:
err_msg = f"Worker exited with status ({p.exitcode})"
if p.exitcode == -9:
err_msg += ": Server reached its memory limit"

raise NonCleanExit(err_msg)

consumer.done_callback(msg)
except Exception as e:
AbstraLogger.error(f"[{head_id}] PreExecController ERROR: aborting consumer")
AbstraLogger.capture_exception(e)
Expand Down Expand Up @@ -89,11 +96,14 @@ def __exit__(self, exc_type, exc_val, exc_tb):
def ExecutionConsumer(consumer: Consumer, controller: MainController):
with Arbiter(controller) as arbiter:
with ThreadPoolExecutor(max_workers=QUEUE_CONCURRENCY) as executor:
for msg in consumer.iter():
executor.submit(
PreExecController,
arbiter_uuid=arbiter.uuid,
controller=controller,
consumer=consumer,
msg=msg,
)
try:
for msg in consumer.iter():
executor.submit(
PreExecController,
arbiter_uuid=arbiter.uuid,
controller=controller,
consumer=consumer,
msg=msg,
)
except Exception as e:
AbstraLogger.capture_exception(e)

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions abstra_statics/dist/assets/ApiKeys.3a8bceff.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions abstra_statics/dist/assets/ApiKeys.f9be26c5.js

This file was deleted.

2 changes: 2 additions & 0 deletions abstra_statics/dist/assets/App.1fb42124.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions abstra_statics/dist/assets/App.7804d823.js

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

2 changes: 2 additions & 0 deletions abstra_statics/dist/assets/Avatar.715e2ca3.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 74dcc10

Please sign in to comment.