Skip to content

Commit

Permalink
correct archive db per dag target db
Browse files Browse the repository at this point in the history
  • Loading branch information
cherusk committed Nov 22, 2023
1 parent af5ad3d commit e3f4b55
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion breeder/linux_network_stack/objective.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@


def objective(trial,
run=None,
identifier=None,
archive_db_url=None,
locking_db_url=None,
Expand Down Expand Up @@ -43,7 +44,7 @@ def objective(trial,

logger.debug('fetching setting data')

breeder_table_name = f"{breeder_name}"
breeder_table_name = f"{breeder_name}_{run}_{identifier}"
query = f"SELECT * FROM {breeder_table_name} WHERE {breeder_table_name}.setting_id = '{setting_id}';"

archive_db_data = archive_db_engine.execute(query).fetchall()
Expand Down
3 changes: 2 additions & 1 deletion breeder/linux_network_stack/optimization.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


def create_optimization_dag(dag_id, config, identifier):
def create_optimization_dag(dag_id, config, run, identifier):

dag = DAG(dag_id,
default_args=DEFAULTS,
Expand All @@ -22,6 +22,7 @@ def run_optimization():

objective_kwargs = dict(archive_db_url=f'postgresql://{ARCHIVE_DB_USER}:{ARCHIVE_DB_PASSWORD}@{ARCHIVE_DB_HOSTNAME}:{ARCHIVE_DB_PORT}/{ARCHIVE_DB_DATABASE}',
locking_db_url=DLM_DB_CONNECTION,
run=run,
identifier=identifier,
breeder_name=config.get('name'),
)
Expand Down
2 changes: 1 addition & 1 deletion breeder/linux_network_stack/root_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def determine_config_shard(run_id=None,
dag_id = f'{dag_name}_{run_id}'
if not is_cooperative:
config = determine_config_shard()
globals()[f'{dag_id}_optimization_{identifier}'] = create_optimization_dag(f'{dag_id}_optimization_{identifier}', config, identifier)
globals()[f'{dag_id}_optimization_{identifier}'] = create_optimization_dag(f'{dag_id}_optimization_{identifier}', config, run_id, identifier)
globals()[f'{dag_id}_target_{identifier}'] = create_target_interaction_dag(f'{dag_id}_target_interaction_{identifier}', config, target, identifier)

target_id += 1

0 comments on commit e3f4b55

Please sign in to comment.