| |
@@ -167,6 +167,7 @@
|
| |
for compose in composes:
|
| |
log.info("%r: Removing compose", compose)
|
| |
compose.state = COMPOSE_STATES["removed"]
|
| |
+ compose.state_reason = "Compose is expired"
|
| |
compose.time_removed = datetime.utcnow()
|
| |
db.session.commit()
|
| |
if not compose.reused_id:
|
| |
@@ -462,6 +463,7 @@
|
| |
_write_repo_file(compose, repofile)
|
| |
|
| |
compose.state = COMPOSE_STATES["done"]
|
| |
+ compose.state_reason = "Compose is generated successfully"
|
| |
log.info("%r: Compose done", compose)
|
| |
compose.time_done = datetime.utcnow()
|
| |
db.session.add(compose)
|
| |
@@ -514,6 +516,7 @@
|
| |
# If there is no exception generated by the pungi.run(), we know
|
| |
# the compose has been successfully generated.
|
| |
compose.state = COMPOSE_STATES["done"]
|
| |
+ compose.state_reason = "Compose is generated successfully"
|
| |
log.info("%r: Compose done", compose)
|
| |
compose.time_done = datetime.utcnow()
|
| |
db.session.add(compose)
|
| |
@@ -569,7 +572,7 @@
|
| |
else:
|
| |
generate_pungi_compose(compose)
|
| |
validate_pungi_compose(compose)
|
| |
- except Exception:
|
| |
+ except Exception as e:
|
| |
# Something went wrong, log the exception and update the compose
|
| |
# state in database.
|
| |
if compose:
|
| |
@@ -577,18 +580,20 @@
|
| |
else:
|
| |
log.exception("Error while generating compose %d", compose_id)
|
| |
compose.state = COMPOSE_STATES["failed"]
|
| |
+ compose.state_reason = "Error while generating compose: %s" % str(e)
|
| |
compose.time_done = datetime.utcnow()
|
| |
db.session.add(compose)
|
| |
db.session.commit()
|
| |
|
| |
- # consolidate duplicate files in compose target dir
|
| |
- if compose and compose.reused_id is None and compose.source_type != PungiSourceType.PULP:
|
| |
- try:
|
| |
- log.info("Running hardlink to consolidate duplicate files in compose target dir")
|
| |
- odcs.server.utils.hardlink(conf.target_dir)
|
| |
- except Exception as ex:
|
| |
- # not fail, just show warning message
|
| |
- log.warn("Error while running hardlink on system: %s" % ex.message, exc_info=True)
|
| |
+ compose = Compose.query.filter(Compose.id == compose_id).one()
|
| |
+ # consolidate duplicate files in compose target dir
|
| |
+ if compose and compose.reused_id is None and compose.source_type != PungiSourceType.PULP:
|
| |
+ try:
|
| |
+ log.info("Running hardlink to consolidate duplicate files in compose target dir")
|
| |
+ odcs.server.utils.hardlink(conf.target_dir)
|
| |
+ except Exception as ex:
|
| |
+ # not fail, just show warning message
|
| |
+ log.warn("Error while running hardlink on system: %s" % ex.message, exc_info=True)
|
| |
|
| |
|
| |
class ComposerThread(BackendThread):
|
| |
@@ -613,6 +618,7 @@
|
| |
the ThreadPoolExecutor can start working on it.
|
| |
"""
|
| |
compose.state = COMPOSE_STATES["generating"]
|
| |
+ compose.state_reason = "Compose thread started"
|
| |
db.session.add(compose)
|
| |
db.session.commit()
|
| |
self.currently_generating.append(compose.id)
|
| |