Skip to content

Commit

Permalink
Merge pull request #77 from AllenNeuralDynamics/han_auto_update_curri…
Browse files Browse the repository at this point in the history
…culums

feat: also update curriculums automatically
  • Loading branch information
hanhou authored Aug 20, 2024
2 parents 7198d03 + 8d5d78a commit c1c205a
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions code/run_capsule.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@

from aind_auto_train import setup_logging, __version__
from aind_auto_train.auto_train_manager import DynamicForagingAutoTrainManager
from aind_auto_train.curriculum_manager import CurriculumManager, LOCAL_SAVED_CURRICULUM_ROOT

setup_logging()
logger = logging.getLogger(__name__)

def update_auto_train_database(managers, interval=10):
def update_auto_train_database(managers, curriculum_manager, interval=600):
while True:
logger.info(f'\n\n --- v{__version__} ---')
try:
logger.info(f'-- Update curriculums --')
curriculum_manager.download_curriculums()
logger.info(f'-- Update training manager --')
for manager_name, manager in managers.items():
manager.update()
except Exception as e:
Expand All @@ -31,9 +36,15 @@ def run():
if_rerun_all=False
)

curriculum_manager = CurriculumManager(
saved_curriculums_on_s3=dict(bucket='aind-behavior-data',
root='foraging_auto_training/saved_curriculums/'),
saved_curriculums_local=LOCAL_SAVED_CURRICULUM_ROOT
)

# create a thread, and run update_auto_train_database() per 1 hour
update_auto_train_database(managers)
thread = threading.Thread(update_auto_train_database, args=[managers])
update_auto_train_database(managers, curriculum_manager)
thread = threading.Thread(update_auto_train_database, args=[managers, curriculum_manager])
thread.start()


Expand Down

0 comments on commit c1c205a

Please sign in to comment.