schd 0.0.13__tar.gz → 0.0.15__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: schd
3
- Version: 0.0.13
3
+ Version: 0.0.15
4
4
  Home-page: https://github.com/kevenli/schd
5
5
  License: ApacheV2
6
6
  Requires-Dist: apscheduler<4.0
@@ -0,0 +1 @@
1
+ __version__ = '0.0.15'
@@ -76,8 +76,8 @@ class RemoteApiClient:
76
76
  data.add_field('logfile', f, filename=os.path.basename(logfile_path), content_type='application/octet-stream')
77
77
 
78
78
  async with session.put(upload_url, data=data) as resp:
79
- print("Status:", resp.status)
80
- print("Response:", await resp.text())
79
+ logger.info("Status: %d", resp.status)
80
+ logger.info("Response: %s", await resp.text())
81
81
 
82
82
 
83
83
  class RemoteScheduler:
@@ -107,7 +107,7 @@ class RemoteScheduler:
107
107
  logger.info('start_main_loop ')
108
108
  try:
109
109
  async for event in self.client.subscribe_worker_eventstream(self._worker_name):
110
- print(event)
110
+ logger.info('got event, %s', event)
111
111
  job_name = event['data']['job_name']
112
112
  instance_id = event['data']['id']
113
113
  _, queue_name = self._jobs[job_name]
@@ -143,10 +143,18 @@ class RemoteScheduler:
143
143
  text_stream = io.TextIOWrapper(output_stream, encoding='utf-8')
144
144
 
145
145
  context = JobContext(job_name=job_name, stdout=text_stream)
146
+ logger.info('starting job %s@%d', job_name, instance_id)
146
147
  await self.client.update_job_instance(self._worker_name, job_name, instance_id, status='RUNNING')
147
148
  try:
148
- with redirect_stdout(text_stream):
149
- job_result = job.execute(context)
149
+ def execute_job():
150
+ with redirect_stdout(text_stream):
151
+ job_result = job.execute(context)
152
+ return job_result
153
+
154
+ loop = asyncio.get_running_loop()
155
+ job_result = await loop.run_in_executor(
156
+ None, execute_job
157
+ )
150
158
 
151
159
  if job_result is None:
152
160
  ret_code = 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: schd
3
- Version: 0.0.13
3
+ Version: 0.0.15
4
4
  Home-page: https://github.com/kevenli/schd
5
5
  License: ApacheV2
6
6
  Requires-Dist: apscheduler<4.0
@@ -7,7 +7,7 @@ def read_requirements():
7
7
 
8
8
  setup(
9
9
  name="schd",
10
- version="0.0.13",
10
+ version="0.0.15",
11
11
  url="https://github.com/kevenli/schd",
12
12
  packages=find_packages(exclude=('tests', 'tests.*')),
13
13
  install_requires=['apscheduler<4.0', 'pyaml', 'aiohttp'],
@@ -1 +0,0 @@
1
- __version__ = '0.0.12'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes