Skip to content

Commit

Permalink
Update version, lint some files with YAPF
Browse files Browse the repository at this point in the history
  • Loading branch information
bkgoksel committed Aug 2, 2018
1 parent 4ed338f commit dfffcbf
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 14 deletions.
2 changes: 1 addition & 1 deletion codalab/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# Increment this on the develop branch when develop is merged into master.
# http://semver.org/
CODALAB_VERSION = '0.2.26'
CODALAB_VERSION = '0.2.27'


class IntegrityError(ValueError):
Expand Down
3 changes: 2 additions & 1 deletion docs/rest.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# REST API Reference

_version 0.2.12_
_version 0.2.27_

This reference and the REST API itself is still under heavy development and is
subject to change at any time. Feedback through our GitHub issues is appreciated!
Expand Down Expand Up @@ -468,6 +468,7 @@ Query parameters:
- `size=.sort- ` : Sort by a particular field in reverse.
- `size=.sum ` : Compute total of a particular field.
- `.mine ` : Match only bundles I own.
- `.shared ` : Match only bundles shared with a group I'm a part of.
- `.floating ` : Match bundles that aren't on any worksheet.
- `.count ` : Count the number of bundles.
- `.limit=10 ` : Limit the number of results to the top 10.
Expand Down
23 changes: 15 additions & 8 deletions worker/codalabworker/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
from download_util import BUNDLE_NO_LONGER_RUNNING_MESSAGE
from state_committer import JsonStateCommitter

VERSION = 19
VERSION = 20

COMMAND_RETRY_SECONDS = 60 * 12

logger = logging.getLogger(__name__)

"""
Codalab Worker
Workers handle communications with the Codalab server. Their main role in Codalab execution
Expand All @@ -25,7 +24,8 @@


class Worker(object):
def __init__(self, create_run_manager, commit_file, worker_id, tag, work_dir, bundle_service):
def __init__(self, create_run_manager, commit_file, worker_id, tag,
work_dir, bundle_service):
self.id = worker_id
self._state_committer = JsonStateCommitter(commit_file)
self._tag = tag
Expand Down Expand Up @@ -111,19 +111,24 @@ def _run(self, bundle, resources):
'start_time': int(now),
}

if self._bundle_service.start_bundle(self.id, bundle['uuid'], start_message):
if self._bundle_service.start_bundle(self.id, bundle['uuid'],
start_message):
self._run_manager.create_run(bundle, resources)
else:
print >>sys.stdout, 'Bundle {} no longer assigned to this worker'.format(bundle['uuid'])
print >> sys.stdout, 'Bundle {} no longer assigned to this worker'.format(
bundle['uuid'])

def _read(self, socket_id, uuid, path, read_args):
def reply(err, message={}, data=None):
self._bundle_service_reply(socket_id, err, message, data)

try:
run_state = self._run_manager.get_run(uuid)
dep_paths = set([dep['child_path'] for dep in run_state.bundle['dependencies']])
self._run_manager.read(run_state, path, dep_paths, read_args, reply)
dep_paths = set([
dep['child_path'] for dep in run_state.bundle['dependencies']
])
self._run_manager.read(run_state, path, dep_paths, read_args,
reply)
except BundleServiceException:
traceback.print_exc()
except Exception as e:
Expand All @@ -134,6 +139,7 @@ def reply(err, message={}, data=None):
def _netcat(self, socket_id, uuid, port, message):
def reply(err, message={}, data=None):
self._bundle_service_reply(socket_id, err, message, data)

try:
run_state = self._run_manager.get_run(uuid)
self._run_manager.netcat(run_state, port, message, reply)
Expand All @@ -146,7 +152,8 @@ def reply(err, message={}, data=None):

def _write(self, uuid, subpath, string):
run_state = self._run_manager.get_run(uuid)
dep_paths = set([dep['child_path'] for dep in run_state.bundle['dependencies']])
dep_paths = set(
[dep['child_path'] for dep in run_state.bundle['dependencies']])
self._run_manager.write(run_state, subpath, dep_paths, string)

def _kill(self, uuid):
Expand Down
13 changes: 9 additions & 4 deletions worker/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@
from setuptools.command.install import install
import os


def get_requirements(*requirements_file_paths):
requirements = []
for requirements_file_path in requirements_file_paths:
with open(requirements_file_path) as requirements_file:
for line in requirements_file:
if line[0:2] != '-r' and line.find('git') == -1 and line.find('codalabworker') == -1:
if line[0:2] != '-r' and line.find('git') == -1 and line.find(
'codalabworker') == -1:
requirements.append(line)
return requirements

setup(name='codalabworker',
version='0.2.23',

setup(
name='codalabworker',
version='0.2.27',
description='Worker for CodaLab, a platform for reproducible computation',
long_description='To use your own hardware in CodaLab Worksheets, visit https://github.com/codalab/codalab-worksheets/wiki/Execution#running-your-own-worker. You can find the code at https://github.com/codalab/codalab-cli.',
long_description=
'To use your own hardware in CodaLab Worksheets, visit https://github.com/codalab/codalab-worksheets/wiki/Execution#running-your-own-worker. You can find the code at https://github.com/codalab/codalab-cli.',
url='https://github.com/codalab/codalab-cli',
author='CodaLab',
author_email='[email protected]',
Expand Down

0 comments on commit dfffcbf

Please sign in to comment.