Browse Source

session add the wrong db entry object fix

master
JoYo 3 years ago
parent
commit
6a1b056ed9
  1. 1
      .gitignore
  2. 2
      docker-compose.yaml
  3. 2
      sins/orm.py
  4. 7
      sins/run.py

1
.gitignore

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

2
docker-compose.yaml

@ -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

2
sins/orm.py

@ -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)

7
sins/run.py

@ -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

Loading…
Cancel
Save