Scheduled Deploy Candidate Error

Data:
{
    "team": "Team(nsptvoto75)",
    "user": "Administrator"
}
Exception:
Traceback with variables (most recent call last):
  File "apps/press/press/press/doctype/deploy_candidate_build/deploy_candidate_build.py", line 1332, in run_scheduled_builds
    doc.run_scheduled_build_and_deploy()
      max_builds = 5
      dcs = ['g3601tmnk7']
      dc = 'g3601tmnk7'
      doc = <DeployCandidateBuild: g3601tmnk7>
  File "apps/press/press/press/doctype/deploy_candidate_build/deploy_candidate_build.py", line 1143, in run_scheduled_build_and_deploy
    self.pre_build()
      self = <DeployCandidateBuild: g3601tmnk7>
  File "apps/press/press/press/doctype/deploy_candidate_build/deploy_candidate_build.py", line 1109, in pre_build
    frappe.enqueue_doc(
      self = <DeployCandidateBuild: g3601tmnk7>
      kwargs = {}
      user = 'Administrator'
      session_data = {}
      team = <Team: nsptvoto75>
      queue = 'build'
  File "apps/frappe/frappe/__init__.py", line 2269, in enqueue_doc
    return frappe.utils.background_jobs.enqueue_doc(*args, **kwargs)
      args = ('Deploy Candidate Build', 'g3601tmnk7', '_build')
      kwargs = {'queue': 'build', 'timeout': 2400, 'enqueue_after_commit': True}
      frappe = <module 'frappe' from 'apps/frappe/frappe/__init__.py'>
  File "apps/frappe/frappe/utils/background_jobs.py", line 177, in enqueue_doc
    return enqueue(
      doctype = 'Deploy Candidate Build'
      name = 'g3601tmnk7'
      method = '_build'
      queue = 'build'
      timeout = 2400
      now = False
      kwargs = {'enqueue_after_commit': True}
  File "apps/frappe/frappe/utils/background_jobs.py", line 123, in enqueue
    q = get_queue(queue, is_async=is_async)
      method = 'frappe.utils.background_jobs.run_doc_method'
      queue = 'build'
      event = None
      is_async = True
      job_name = None
      now = False
      enqueue_after_commit = True
      deduplicate = False
      kwargs = {'doctype': 'Deploy Candidate Build', 'name': 'g3601tmnk7', 'doc_method': '_build'}
      call_directly = False
      at_front = False
      job_id = 'taywan.dev::053962fc-124f-4ab3-87db-0c3071e235e7'
      on_failure = None
      on_success = None
      timeout = 2400
  File "apps/frappe/frappe/utils/background_jobs.py", line 458, in get_queue
    validate_queue(qtype)
      qtype = 'build'
      is_async = True
  File "apps/frappe/frappe/utils/background_jobs.py", line 467, in validate_queue
    frappe.throw(_("Queue should be one of {0}").format(", ".join(default_queue_list)))
      queue = 'build'
      default_queue_list = ['short', 'default', 'long']
  File "apps/frappe/frappe/__init__.py", line 609, in throw
    msgprint(
      msg = 'Queue should be one of short, default, long'
      exc = <class 'frappe.exceptions.ValidationError'>
      title = None
      is_minimizable = False
      wide = False
      as_list = False
      primary_action = None
  File "apps/frappe/frappe/__init__.py", line 574, in msgprint
    _raise_exception()
      title = None
      as_table = False
      as_list = False
      indicator = 'red'
      alert = False
      primary_action = None
      is_minimizable = False
      wide = False
      realtime = False
      sys = <module 'sys' (built-in)>
      _raise_exception = <function msgprint.<locals>._raise_exception at 0x789e97f0d630>
      inspect = <module 'inspect' from '/usr/lib/python3.10/inspect.py'>
      msg = 'Queue should be one of short, default, long'
      out = {'message': 'Queue should be one of short, default, long', 'title': 'Message', 'indicator': 'red', 'raise_exception': 1, '__frappe_exc_id': 'bcab8dc89ec19a68f6a51b35a74e478ce5aaa20cdb236b5ee41223c6'}
      raise_exception = <class 'frappe.exceptions.ValidationError'>
  File "apps/frappe/frappe/__init__.py", line 525, in _raise_exception
    raise exc
      exc = ValidationError('Queue should be one of short, default, long')
      inspect = <module 'inspect' from '/usr/lib/python3.10/inspect.py'>
      msg = 'Queue should be one of short, default, long'
      out = {'message': 'Queue should be one of short, default, long', 'title': 'Message', 'indicator': 'red', 'raise_exception': 1, '__frappe_exc_id': 'bcab8dc89ec19a68f6a51b35a74e478ce5aaa20cdb236b5ee41223c6'}
      raise_exception = <class 'frappe.exceptions.ValidationError'>
frappe.exceptions.ValidationError: Queue should be one of short, default, long

as a matter of fact I delegated the app server to do the building, but it seems nothing is being initiated

@AWS @corentin this happen to you?

Press needs more queues than the default ones (short, …) to run:

build (for the build)
sync (for syncing sites)
+ the standard ones already existing: short, default, long

The build queue is used regardless of the location of the actual building. I think there is a packaging build context step that happens on the Press server (which copies the application files from the Press server to the remote build server). If I remember correctly, newer versions of Press don’t have “local” building anyways (building on the Press server itself), only remote building, but they still use the build queue.

The fix

Update the common_site_config.json file, then run bench setup production again and restart the bench.

# common_site_config.json
{
 "workers": {
  "build": {
   "timeout": 1500
  },
  "sync": {
   "timeout": 60
  }
 }
}

If it does not work, do this hard update instead but i think this is overkill:

vim sites/common_site_config.json 
bench setup supervisor
sudo supervisorctl reread
sudo supervisorctl update
bench restart

References

1 Like

Chief @corentin

Very much appreciated it worked, it is only that now everytime I schedule a build I need to go to bench and run

bench --site site.com execute \
  press.press.doctype.deploy_candidate_build.deploy_candidate_build.run_scheduled_builds

I sat up a cron becouse when I click a build it only gives me a schedule dropdown only