schd 0.0.14__tar.gz → 0.0.16__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.14
3
+ Version: 0.0.16
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.16'
@@ -12,8 +12,5 @@ class JobsCommand(CommandBase):
12
12
 
13
13
  def run(self, args):
14
14
  config = read_config(config_file=args.config)
15
- for job_name, job_config in config['jobs'].items():
16
- job_class_name = job_config.pop('class')
17
- job_cron = job_config.pop('cron')
18
- # print(f'{job_name} : {job_class_name} {job_cron}')
15
+ for job_name, _ in config.jobs.items():
19
16
  print(job_name)
@@ -1,5 +1,4 @@
1
1
  import logging
2
- import yaml
3
2
  from schd.cmds.base import CommandBase
4
3
  from schd.scheduler import build_job, read_config, JobContext
5
4
 
@@ -7,11 +6,9 @@ from schd.scheduler import build_job, read_config, JobContext
7
6
  def run_job(config_file, job_name):
8
7
  config = read_config(config_file)
9
8
 
10
- job_config = config['jobs'][job_name]
9
+ job_config = config.jobs[job_name]
11
10
 
12
- job_class_name = job_config.pop('class')
13
- job_cron = job_config.pop('cron')
14
- job = build_job(job_name, job_class_name, job_config)
11
+ job = build_job(job_name, job_config.cls, job_config)
15
12
  job_context = JobContext(job_name)
16
13
  job_context.output_to_console = True
17
14
  job(context=job_context)
@@ -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]
@@ -146,12 +146,15 @@ class RemoteScheduler:
146
146
  logger.info('starting job %s@%d', job_name, instance_id)
147
147
  await self.client.update_job_instance(self._worker_name, job_name, instance_id, status='RUNNING')
148
148
  try:
149
+ def execute_job():
150
+ with redirect_stdout(text_stream):
151
+ job_result = job.execute(context)
152
+ return job_result
153
+
149
154
  loop = asyncio.get_running_loop()
150
- with redirect_stdout(text_stream):
151
- # job_result = job.execute(context)
152
- job_result = await loop.run_in_executor(
153
- None, job.execute, context
154
- )
155
+ job_result = await loop.run_in_executor(
156
+ None, execute_job
157
+ )
155
158
 
156
159
  if job_result is None:
157
160
  ret_code = 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: schd
3
- Version: 0.0.14
3
+ Version: 0.0.16
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.14",
10
+ version="0.0.16",
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.14'
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