session add the wrong db entry object fix
							parent
							
								
									ce4e8b57c5
								
							
						
					
					
						commit
						6a1b056ed9
					
				| 
						 | 
					@ -1,2 +1,3 @@
 | 
				
			||||||
__pycache__/
 | 
					__pycache__/
 | 
				
			||||||
seed
 | 
					seed
 | 
				
			||||||
 | 
					out/
 | 
				
			||||||
| 
						 | 
					@ -7,5 +7,5 @@ services:
 | 
				
			||||||
    volumes:
 | 
					    volumes:
 | 
				
			||||||
      - ${PWD}:/app
 | 
					      - ${PWD}:/app
 | 
				
			||||||
    working_dir: /app
 | 
					    working_dir: /app
 | 
				
			||||||
    command: python3 -m sins
 | 
					    command: python3 -m sins -o out/
 | 
				
			||||||
    # command: yasm seed.asm -o seed
 | 
					    # command: yasm seed.asm -o seed
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,10 +44,10 @@ class ScrapNode(Base):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					    def __repr__(self):
 | 
				
			||||||
        values = {
 | 
					        values = {
 | 
				
			||||||
            'id': self.id,
 | 
					 | 
				
			||||||
            'checksum': self.checksum,
 | 
					            'checksum': self.checksum,
 | 
				
			||||||
            'length': self.length,
 | 
					            'length': self.length,
 | 
				
			||||||
            'parent_id': self.parent_id,
 | 
					            'parent_id': self.parent_id,
 | 
				
			||||||
 | 
					            'id': self.id,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return str(values)
 | 
					        return str(values)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -58,7 +58,7 @@ def sins():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    seed = ScrapNode(child=seed_data)
 | 
					    seed = ScrapNode(child=seed_data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    logger.info(f'seed:\n{seed}')
 | 
					    logger.debug(f'seed:\n{seed}')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if args.output:
 | 
					    if args.output:
 | 
				
			||||||
        db_path = Path(f'{args.output}/sins.sqlite')
 | 
					        db_path = Path(f'{args.output}/sins.sqlite')
 | 
				
			||||||
| 
						 | 
					@ -82,6 +82,7 @@ def sins():
 | 
				
			||||||
        recent = session.query(ScrapNode).order_by(desc('ctime')).first()
 | 
					        recent = session.query(ScrapNode).order_by(desc('ctime')).first()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if recent:
 | 
					        if recent:
 | 
				
			||||||
 | 
					            logger.debug(f'recent:\n{recent}')
 | 
				
			||||||
            seed = recent
 | 
					            seed = recent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    parent = seed
 | 
					    parent = seed
 | 
				
			||||||
| 
						 | 
					@ -93,7 +94,7 @@ def sins():
 | 
				
			||||||
        scrap = flip(parent.image)
 | 
					        scrap = flip(parent.image)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        while lineage < args.lineage:
 | 
					        while lineage < args.lineage:
 | 
				
			||||||
            logger.info(f'lineage: {lineage}')
 | 
					            logger.debug(f'lineage: {lineage}')
 | 
				
			||||||
            result = None
 | 
					            result = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            proc = Process(target=generation, args=(queue, scrap))
 | 
					            proc = Process(target=generation, args=(queue, scrap))
 | 
				
			||||||
| 
						 | 
					@ -110,7 +111,7 @@ def sins():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            parent = ScrapNode(child=scrap, parent_id=parent.id)
 | 
					            parent = ScrapNode(child=scrap, parent_id=parent.id)
 | 
				
			||||||
            parent.length = result
 | 
					            parent.length = result
 | 
				
			||||||
            session.add(seed)
 | 
					            session.add(parent)
 | 
				
			||||||
            session.commit()
 | 
					            session.commit()
 | 
				
			||||||
            logger.info(f'scrap:\n{parent}')
 | 
					            logger.info(f'scrap:\n{parent}')
 | 
				
			||||||
            lineage = 0
 | 
					            lineage = 0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue