session add the wrong db entry object fix

master
JoYo 2019-02-19 22:56:11 +00:00
parent ce4e8b57c5
commit 6a1b056ed9
4 changed files with 7 additions and 5 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
__pycache__/
seed
out/

View File

@ -7,5 +7,5 @@ services:
volumes:
- ${PWD}:/app
working_dir: /app
command: python3 -m sins
command: python3 -m sins -o out/
# command: yasm seed.asm -o seed

View File

@ -44,10 +44,10 @@ class ScrapNode(Base):
def __repr__(self):
values = {
'id': self.id,
'checksum': self.checksum,
'length': self.length,
'parent_id': self.parent_id,
'id': self.id,
}
return str(values)

View File

@ -58,7 +58,7 @@ def sins():
seed = ScrapNode(child=seed_data)
logger.info(f'seed:\n{seed}')
logger.debug(f'seed:\n{seed}')
if args.output:
db_path = Path(f'{args.output}/sins.sqlite')
@ -82,6 +82,7 @@ def sins():
recent = session.query(ScrapNode).order_by(desc('ctime')).first()
if recent:
logger.debug(f'recent:\n{recent}')
seed = recent
parent = seed
@ -93,7 +94,7 @@ def sins():
scrap = flip(parent.image)
while lineage < args.lineage:
logger.info(f'lineage: {lineage}')
logger.debug(f'lineage: {lineage}')
result = None
proc = Process(target=generation, args=(queue, scrap))
@ -110,7 +111,7 @@ def sins():
parent = ScrapNode(child=scrap, parent_id=parent.id)
parent.length = result
session.add(seed)
session.add(parent)
session.commit()
logger.info(f'scrap:\n{parent}')
lineage = 0