Skip to content

Commit

Permalink
update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
jarno-knaw committed Aug 1, 2024
1 parent a2f8098 commit e958721
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added
- Added support for YAML configurations.
- Allow specifying external config/rdf files.
- Added support for trig files.
- Import vocabularies every hour using cron.
- Added a configuration option for the refresh interval of vocabularies.

## [v2.15-1.1.0]

Expand Down
21 changes: 14 additions & 7 deletions entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ def append_file(source: IO, dest: str):
df.write(line)


if __name__ == "__main__":
time.sleep(10)

def main() -> None:
"""
Main function.
:return:
"""
data = os.environ["DATA"]

if os.path.isfile(f'{data}/config.ttl'):
Expand Down Expand Up @@ -62,15 +64,15 @@ def append_file(source: IO, dest: str):
graph = get_graph(config)
print(f"Graph: {graph}")

should_reload = False
reload = False
if graph not in loaded_vocabs:
should_reload = True
reload = True
elif vocab_config['config'].get('refresh', False):
interval = vocab_config['config'].get('refreshInterval', 0)
diff = (time.time() - loaded_vocabs[graph]) / 3600
should_reload = diff > interval
reload = diff > interval

if should_reload:
if reload:
print(f"Loading vocabulary {vocab}")
load_vocabulary(vocab_config['source'], data, graph)
if graph in loaded_vocabs:
Expand All @@ -86,3 +88,8 @@ def append_file(source: IO, dest: str):
print(f"Invalid configuration: {e}")
print(f"Skipping vocab '{vocab}'")
continue


if __name__ == "__main__":
time.sleep(10)
main()

0 comments on commit e958721

Please sign in to comment.