diff --git a/lapis/drone.py b/lapis/drone.py
index b6d9cab..9826c78 100644
--- a/lapis/drone.py
+++ b/lapis/drone.py
@@ -1,5 +1,5 @@
 from cobald import interfaces
-from usim import time, Scope, instant, Capacities, ResourcesUnavailable
+from usim import time, Scope, instant, Capacities, ResourcesUnavailable, Queue
 
 from lapis.job import Job
 
@@ -44,6 +44,7 @@ class Drone(interfaces.Pool):
         self.jobs = 0
         self._allocation = None
         self._utilisation = None
+        self._job_queue = Queue()
 
     @property
     def theoretical_available_resources(self):
@@ -60,6 +61,9 @@ class Drone(interfaces.Pool):
         self._supply = 1
         self.scheduler.register_drone(self)
         await sampling_required.put(self)
+        async with Scope() as scope:
+            async for job, kill in self._job_queue:
+                scope.do(self._run_job(job=job, kill=kill))
 
     @property
     def supply(self) -> float:
@@ -103,7 +107,10 @@ class Drone(interfaces.Pool):
         await sampling_required.put(self)  # TODO: introduce state of drone
         await (time + 1)
 
-    async def start_job(self, job: Job, kill: bool = False):
+    async def schedule_job(self, job: Job, kill: bool = False):
+        await self._job_queue.put((job, kill))
+
+    async def _run_job(self, job: Job, kill: bool):
         """
         Method manages to start a job in the context of the given drone.
         The job is started independent of available resources. If resources of
@@ -147,6 +154,9 @@ class Drone(interfaces.Pool):
                 await instant
                 job_execution.cancel()
             self.jobs -= 1
+            if not job.successful:
+                job.drone = None
+                await self.scheduler.retry_job(job)
             self._utilisation = self._allocation = None
             self.scheduler.update_drone(self)
             await sampling_required.put(self)
diff --git a/lapis/pool.py b/lapis/pool.py
index 928b710..2a3e465 100644
--- a/lapis/pool.py
+++ b/lapis/pool.py
@@ -29,20 +29,21 @@ class Pool(interfaces.Pool):
         assert init <= capacity
         self.make_drone = make_drone
         self._drones = []
-        self.init_pool(init=init)
         self._demand = 1
         self._level = init
         self._capacity = capacity
         self._name = name
 
-    def init_pool(self, init: int = 0):
+    async def init_pool(self, scope: Scope, init: int = 0):
         """
         Initialisation of existing drones at creation time of pool.
 
         :param init: Number of drones to create.
         """
         for _ in range(init):
-            self._drones.append(self.make_drone(0))
+            drone = self.make_drone(0)
+            scope.do(drone.run())
+            self._drones.append(drone)
 
     # TODO: the run method currently needs to be called manually
     async def run(self):
@@ -52,6 +53,7 @@ class Pool(interfaces.Pool):
         initialising new drones. Otherwise drones get removed.
         """
         async with Scope() as scope:
+            await self.init_pool(scope=scope, init=self._level)
             async for _ in interval(1):
                 drones_required = min(self._demand, self._capacity) - self._level
                 while drones_required > 0:
@@ -145,5 +147,6 @@ class StaticPool(Pool):
         """
         Pool runs forever and does not check if number of drones needs to be adapted.
         """
-        while True:
+        async with Scope() as scope:
+            await self.init_pool(scope=scope, init=self._level)
             await eternity
diff --git a/lapis/scheduler.py b/lapis/scheduler.py
index c3ad63e..7e9a42d 100644
--- a/lapis/scheduler.py
+++ b/lapis/scheduler.py
@@ -90,7 +90,7 @@ class CondorJobScheduler(object):
                 for job in self.job_queue:
                     best_match = self._schedule_job(job)
                     if best_match:
-                        scope.do(best_match.start_job(job))
+                        await best_match.schedule_job(job)
                         self.job_queue.remove(job)
                         await sampling_required.put(self.job_queue)
                         self.unregister_drone(best_match)
@@ -111,6 +111,9 @@ class CondorJobScheduler(object):
             await sampling_required.put(self.job_queue)
         self._collecting = False
 
+    async def retry_job(self, job):
+        await self._stream_queue.put(job)
+
     def _schedule_job(self, job) -> Drone:
         priorities = {}
         for cluster in self.drone_cluster:

Job transfers seem to interrupt scheduling cycle
@tfesenbecker reported there seems to be an issue with the scheduling cycle when files are transferred from within jobs. As jobs should be absolutely independent from the scheduler itself, this should not happen at all. So we should ensure that file transfer can last longer than the scheduling cycle without any negative influence on the environment including scheduler, pools, or drones.
diff --git a/lapis_tests/test_job.py b/lapis_tests/test_job.py
index 13b4090..3c75916 100644
--- a/lapis_tests/test_job.py
+++ b/lapis_tests/test_job.py
@@ -47,9 +47,10 @@ class TestJob(object):
             pool_resources={"cores": 1, "memory": 1},
             scheduling_duration=0,
         )
+        await drone.run()
         async with Scope() as scope:
-            scope.do(drone.start_job(job=job))
-        assert 10 == time
+            scope.do(drone.schedule_job(job=job))
+        assert 10 == time.now
         assert 0 == job.waiting_time
         assert job.successful
 
@@ -65,8 +66,9 @@ class TestJob(object):
             pool_resources={"cores": 1, "memory": 1},
             scheduling_duration=0,
         )
+        await drone.run()
         async with Scope() as scope:
-            scope.do(drone.start_job(job=job))
+            scope.do(drone.schedule_job(job=job))
         assert 0 == time
         assert not job.successful
         assert 0 == job.waiting_time
@@ -87,9 +89,10 @@ class TestJob(object):
             pool_resources={"cores": 1, "memory": 1},
             scheduling_duration=0,
         )
+        await drone.run()
         async with Scope() as scope:
-            scope.do(drone.start_job(job=job_one))
-            scope.do(drone.start_job(job=job_two))
+            scope.do(drone.schedule_job(job=job_one))
+            scope.do(drone.schedule_job(job=job_two))
         assert 10 == time
         assert job_one.successful
         assert not job_two.successful
@@ -112,9 +115,10 @@ class TestJob(object):
             pool_resources={"cores": 2, "memory": 2},
             scheduling_duration=0,
         )
+        await drone.run()
         async with Scope() as scope:
-            scope.do(drone.start_job(job=job_one))
-            scope.do(drone.start_job(job=job_two))
+            scope.do(drone.schedule_job(job=job_one))
+            scope.do(drone.schedule_job(job=job_two))
         assert 10 == time
         assert job_one.successful
         assert job_two.successful

pip install -e .[dev]
parse_log_pytest
pytest
pytest
apt-get update apt-get install -y gcc
3.7
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs @ file:///croot/attrs_1668696182826/work
certifi @ file:///croot/certifi_1671487769961/work/certifi
cfgv==3.3.1
click==8.1.8
cobald==0.13.0
distlib==0.3.9
entrypoints==0.4
exceptiongroup==1.2.2
filelock==3.12.2
flit_core @ file:///opt/conda/conda-bld/flit-core_1644941570762/work/source/flit_core
identify==2.5.24
idna==3.10
importlib-metadata==6.7.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
-e git+https://github.com/MatterMiners/lapis.git@a698820f4ee6700157aafb511206c39e51a85cae#egg=lapis_sim
nodeenv==1.9.1
outcome==1.3.0.post0
packaging @ file:///croot/packaging_1671697413597/work
platformdirs==4.0.0
pluggy @ file:///tmp/build/80754af9/pluggy_1648042572264/work
pre-commit==2.21.0
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pytest==7.1.2
PyYAML==6.0.1
sniffio==1.3.1
sortedcontainers==2.4.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
toposort==1.10
trio==0.22.2
typing_extensions==4.7.1
usim==0.4.0
virtualenv==20.26.6
zipp @ file:///croot/zipp_1672387121353/work

name: lapis
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - attrs=22.1.0=py37h06a4308_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - flit-core=3.6.0=pyhd3eb1b0_0
  - importlib_metadata=4.11.3=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=22.0=py37h06a4308_0
  - pip=22.3.1=py37h06a4308_0
  - pluggy=1.0.0=py37h06a4308_1
  - py=1.11.0=pyhd3eb1b0_0
  - pytest=7.1.2=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tomli=2.0.1=py37h06a4308_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.11.0=py37h06a4308_0
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - cfgv==3.3.1
      - click==8.1.8
      - cobald==0.13.0
      - distlib==0.3.9
      - entrypoints==0.4
      - exceptiongroup==1.2.2
      - filelock==3.12.2
      - identify==2.5.24
      - idna==3.10
      - importlib-metadata==6.7.0
      - lapis-sim==0.3.0
      - nodeenv==1.9.1
      - outcome==1.3.0.post0
      - platformdirs==4.0.0
      - pre-commit==2.21.0
      - pyyaml==6.0.1
      - sniffio==1.3.1
      - sortedcontainers==2.4.0
      - toposort==1.10
      - trio==0.22.2
      - typing-extensions==4.7.1
      - usim==0.4.0
      - virtualenv==20.26.6
prefix: /opt/conda/envs/lapis

lapis_tests/test_job.py::TestJob::test_job_in_drone lapis_tests/test_job.py::TestJob::test_nonmatching_job_in_drone lapis_tests/test_job.py::TestJob::test_two_nonmatching_jobs lapis_tests/test_job.py::TestJob::test_two_matching_jobs
lapis_tests/test_job.py::TestJob::test_init lapis_tests/test_job.py::TestJob::test_name lapis_tests/test_job.py::TestJob::test_run_job
lapis/scheduler.py lapis/drone.py lapis/pool.py
lapis/scheduler.py lapis/drone.py lapis/pool.py