Skip to content

Commit

Permalink
Merge pull request #40 from pitangainnovare/impl/v1.0.0
Browse files Browse the repository at this point in the history
Gera versão v1.0.0
  • Loading branch information
pitangainnovare authored Jul 31, 2024
2 parents 036ea79 + f3c8b50 commit 5cb355e
Show file tree
Hide file tree
Showing 29 changed files with 644 additions and 411 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Solr
index/data/usage
index/data/log_manager/data
index/data/metrics/data
index/logs

# media
core/media

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.1
1.0.0
11 changes: 0 additions & 11 deletions config/api_router.py

This file was deleted.

12 changes: 0 additions & 12 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,21 +425,9 @@
},
}

HAYSTACK_ROUTERS = [
"core.routers.UpdateEverythingRouter",
]

USE_SOLR = env.bool("USE_SOLR", default=False)

if USE_SOLR:
HAYSTACK_SIGNAL_PROCESSOR = "haystack.signals.RealtimeSignalProcessor"

SEARCH_PAGINATION_ITEMS_PER_PAGE = 10

# SEARCH_FACET_ITEMS_PER_MORE = 5

# SEARCH_FACET_LIST = [
# "server_time",
# "action_name",
# "browser_name",
# ]
6 changes: 0 additions & 6 deletions core/routers.py

This file was deleted.

2 changes: 1 addition & 1 deletion index/data/metrics/conf/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
<field name="collection" type="string" indexed="true" stored="true" multiValued="false"/>

<!-- journal -->
<field name="key_issn" type="string" indexed="true" stored="true" multiValued="false"/>
<field name="pid_issn" type="string" indexed="true" stored="true" multiValued="false"/>

<!-- document identifier -->
<field name="pid" type="string" indexed="true" stored="true" multiValued="false"/>
Expand Down
20 changes: 4 additions & 16 deletions local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ services:
- mailhog
- pgbouncer
- solr
- minio
links:
- pgbouncer
- solr
volumes:
- .:/app:z
- ../scms_data/usage/data:/data
- ../scms_data/scielo_usage/data/logs:/data/logs
- ../scms_data/scielo_usage/data/supplies:/data/supplies
env_file:
- ./.envs/.local/.django
- ./.envs/.local/.postgres
Expand Down Expand Up @@ -51,27 +51,15 @@ services:
- SOLR_JAVA_MEM=-Xms512m -Xmx512m
- SOLR_HEAP=512m

minio:
image: 'minio/minio:RELEASE.2024-03-21T23-13-43Z'
container_name: scielo_usage_local_minio
ports:
- '9000:9000'
- '9001:9001'
env_file:
- ./.envs/.local/.minio
volumes:
- ../scms_data/minio:/data
command: server --console-address ":9001" /data

postgres:
build:
context: .
dockerfile: ./compose/production/postgres/Dockerfile
image: scielo_usage_local_postgres
container_name: scielo_usage_local_postgres
volumes:
- ../scms_data/postgresql:/var/lib/postgresql/data:Z
- ../scms_data/postgresql_backup:/backups:z
- ../scms_data/scielo_usage/postgresql:/var/lib/postgresql/data:Z
- ../scms_data/scielo_usage/postgresql_backup:/backups:z
ports:
- "5439:5432"
env_file:
Expand Down
3 changes: 3 additions & 0 deletions log_manager/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ class UndefinedCollectionConfigError(Exception):

class MultipleCollectionConfigError(Exception):
...

class UnsupportedFileExtentionError(Exception):
...
40 changes: 15 additions & 25 deletions log_manager/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@
from collection.models import Collection
from core.forms import CoreAdminModelForm
from core.models import CommonControlField
from tracker.models import UnexpectedEvent

from . import choices
from .exceptions import (
LogFileAlreadyExistsError,
MultipleCollectionConfigError,
UndefinedCollectionConfigError,
)
Expand Down Expand Up @@ -214,15 +212,19 @@ class Meta:
)

@classmethod
def create(cls, user, log_file, date):
obj = cls()
def create_or_update(cls, user, log_file, date):
obj, created = cls.objects.get_or_create(
log_file=log_file,
date=date,
)

if not created:
obj.updated_by = user
obj.updated = datetime.utcnow()
else:
obj.creator = user
obj.created = datetime.utcnow()

obj.creator = user
obj.created = datetime.utcnow()
obj.log_file = log_file
obj.date = date
obj.save()

return obj

@classmethod
Expand Down Expand Up @@ -321,11 +323,8 @@ def create_or_update(cls, user, collection, date, expected_log_files, found_log_
else:
obj.status = choices.COLLECTION_LOG_FILE_DATE_COUNT_OK

try:
obj.save()
return obj
except IntegrityError:
...
obj.save()
return obj

class Meta:
ordering = ['-date']
Expand Down Expand Up @@ -390,16 +389,7 @@ def get(cls, hash):
@classmethod
def create(cls, user, collection, path, stat_result, hash, status=None):
try:
obj = cls.get(hash=hash)
UnexpectedEvent.create(
LogFileAlreadyExistsError,
detail={
'Error': _('File hash is already registered.'),
'Action': _('No action required from the user.'),
'Result': _('The file has been ignored.'),
'Hash': hash,
})
return
return cls.get(hash=hash)
except cls.DoesNotExist:
obj = cls()
obj.creator = user
Expand Down
Loading

0 comments on commit 5cb355e

Please sign in to comment.