work_spec is a dict()
        work_spec['name'] is used as work_spec_name in other API calls
        work_spec['nice'] is used for prioritization, if set.

def set_work_spec(self, work_spec):
        '''
        work_spec is a dict()
        work_spec['name'] is used as work_spec_name in other API calls
        work_spec['nice'] is used for prioritization, if set.
        '''
        self.validate_work_spec(work_spec)

        nice = int(work_spec.get('nice', 0))
        work_spec_name = work_spec['name']
        with self.registry.lock(identifier=self.worker_id) as session:
            session.update(NICE_LEVELS, {work_spec_name: nice})
            session.update(WORK_SPECS,  {work_spec_name: work_spec})