Skip to content

Commit

Permalink
Add default session
Browse files Browse the repository at this point in the history
  • Loading branch information
tukiains committed Nov 1, 2023
1 parent 141146a commit 4def921
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion scripts/put-legacy-files.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def main(ARGS: argparse.Namespace):
logging.basicConfig(level="INFO")

config = utils.read_main_conf()
md_api = MetadataApi(config, make_session())
md_api = MetadataApi(config)
storage_api = StorageApi(config, make_session())
pid_utils = PidUtils(config)
ARGS.site = PurePath(ARGS.path[0]).name
Expand Down
2 changes: 1 addition & 1 deletion src/data_processing/metadata_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class MetadataApi:
"""Class handling connection between Cloudnet files and database."""

def __init__(self, config: dict, session: requests.Session):
def __init__(self, config: dict, session: requests.Session = utils.make_session()):
self.config = config
self.session = session
self._url = config["DATAPORTAL_URL"]
Expand Down
2 changes: 1 addition & 1 deletion src/data_processing/subcmds/create_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def main(args, storage_session: requests.Session | None = None):
if storage_session is None:
storage_session = make_session()
config = read_main_conf()
md_api = metadata_api.MetadataApi(config, make_session())
md_api = metadata_api.MetadataApi(config)
storage_api = StorageApi(config, storage_session)
metadata = md_api.find_product_metadata(args)
temp_dir_root = utils.get_temp_dir(config)
Expand Down
2 changes: 1 addition & 1 deletion src/data_processing/subcmds/create_qc_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def main(args, storage_session: requests.Session | None = None):
if storage_session is None:
storage_session = make_session()
config = read_main_conf()
md_api = metadata_api.MetadataApi(config, make_session())
md_api = metadata_api.MetadataApi(config)
storage_api = StorageApi(config, storage_session)
metadata = md_api.find_product_metadata(args, legacy_files=False)
temp_dir_root = utils.get_temp_dir(config)
Expand Down
2 changes: 1 addition & 1 deletion src/data_processing/subcmds/freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def main(args, storage_session: requests.Session | None = None):

config = read_main_conf()
pid_utils = PidUtils(config)
md_api = metadata_api.MetadataApi(config, make_session())
md_api = metadata_api.MetadataApi(config)
storage_api = StorageApi(config, storage_session)
metadata = md_api.find_files_to_freeze(args)
logging.info(f"Found {len(metadata)} files to freeze.")
Expand Down
2 changes: 1 addition & 1 deletion src/data_processing/subcmds/upload_to_dvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

def main(args):
config = utils.read_main_conf()
md_api = MetadataApi(config, utils.make_session())
md_api = MetadataApi(config)

if args.truncate:
_truncate_clu_data(md_api)
Expand Down

0 comments on commit 4def921

Please sign in to comment.