mirror of
https://github.com/YunoHost/yunorunner.git
synced 2024-09-03 20:05:52 +02:00
[mod] disociate job from repo
This commit is contained in:
parent
ffd5eae5e8
commit
d40beab8b2
3 changed files with 7 additions and 5 deletions
|
@ -14,7 +14,8 @@ class Repo(peewee.Model):
|
||||||
|
|
||||||
|
|
||||||
class Job(peewee.Model):
|
class Job(peewee.Model):
|
||||||
repo = peewee.ForeignKeyField(Repo)
|
name = peewee.CharField()
|
||||||
|
url_or_path = peewee.CharField()
|
||||||
target_revision = peewee.CharField()
|
target_revision = peewee.CharField()
|
||||||
yunohost_version = peewee.CharField()
|
yunohost_version = peewee.CharField()
|
||||||
|
|
||||||
|
|
7
run.py
7
run.py
|
@ -59,7 +59,8 @@ async def initialize_app_list():
|
||||||
|
|
||||||
print(f"Schedule a new build for {app_id}")
|
print(f"Schedule a new build for {app_id}")
|
||||||
Job.create(
|
Job.create(
|
||||||
repo=repo,
|
name=f"{app_id} stable",
|
||||||
|
url_or_path=repo.url,
|
||||||
target_revision=app_data["git"]["revision"],
|
target_revision=app_data["git"]["revision"],
|
||||||
yunohost_version="stretch-stable",
|
yunohost_version="stretch-stable",
|
||||||
state="scheduled",
|
state="scheduled",
|
||||||
|
@ -110,7 +111,7 @@ async def run_job(worker, job):
|
||||||
}, "jobs")
|
}, "jobs")
|
||||||
|
|
||||||
# fake stupid command, whould run CI instead
|
# fake stupid command, whould run CI instead
|
||||||
print(f"Starting job for {job.repo.name}...")
|
print(f"Starting job {job.name}...")
|
||||||
command = await asyncio.create_subprocess_shell("/usr/bin/tail /var/log/auth.log",
|
command = await asyncio.create_subprocess_shell("/usr/bin/tail /var/log/auth.log",
|
||||||
stdout=asyncio.subprocess.PIPE,
|
stdout=asyncio.subprocess.PIPE,
|
||||||
stderr=asyncio.subprocess.PIPE)
|
stderr=asyncio.subprocess.PIPE)
|
||||||
|
@ -123,7 +124,7 @@ async def run_job(worker, job):
|
||||||
# XXX stupid crap to stimulate long jobs
|
# XXX stupid crap to stimulate long jobs
|
||||||
await asyncio.sleep(random.randint(1, 15))
|
await asyncio.sleep(random.randint(1, 15))
|
||||||
# await asyncio.sleep(5)
|
# await asyncio.sleep(5)
|
||||||
print(f"Finished job for {job.repo.name}")
|
print(f"Finished job {job.name}")
|
||||||
|
|
||||||
await command.wait()
|
await command.wait()
|
||||||
job.end_time = datetime.now()
|
job.end_time = datetime.now()
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<th>End time</th>
|
<th>End time</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-for="job in jobs" :id="job.id">
|
<tr v-for="job in jobs" :id="job.id">
|
||||||
<td>{{job.repo.name}}</td>
|
<td>{{job.name}}</td>
|
||||||
<td>{{job.state}}</td>
|
<td>{{job.state}}</td>
|
||||||
<td>{{job.target_revision}}</td>
|
<td>{{job.target_revision}}</td>
|
||||||
<td>{{job.yunohost_version}}</td>
|
<td>{{job.yunohost_version}}</td>
|
||||||
|
|
Loading…
Add table
Reference in a new issue