I'm trying to build a job queue with Redis Queue and RQ-scheduler. But from RQ-dashboard I get the following error when I try to load the jobs tab. I see that the jobs are added because the job count is going up.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/rq_dashboard/web.py", line 101, in _wrapped
result_dict = f(*args, **kwargs)
File "/rq_dashboard/web.py", line 428, in list_jobs
queue_name, registry_name, offset, per_page
File "/rq_dashboard/web.py", line 233, in get_queue_registry_jobs_count
current_queue_jobs = [queue.fetch_job(job_id) for job_id in job_ids]
File "/rq_dashboard/web.py", line 233, in <listcomp>
current_queue_jobs = [queue.fetch_job(job_id) for job_id in job_ids]
File "/usr/local/lib/python3.7/site-packages/rq/queue.py", line 147, in fetch_job
job = self.job_class.fetch(job_id, connection=self.connection)
File "/usr/local/lib/python3.7/site-packages/rq/job.py", line 299, in fetch
job.refresh()
File "/usr/local/lib/python3.7/site-packages/rq/job.py", line 506, in refresh
self.restore(data)
File "/usr/local/lib/python3.7/site-packages/rq/job.py", line 474, in restore
self.started_at = str_to_date(obj.get('started_at'))
File "/usr/local/lib/python3.7/site-packages/rq/utils.py", line 256, in str_to_date
return utcparse(as_text(date_str))
File "/usr/local/lib/python3.7/site-packages/rq/utils.py", line 172, in utcparse
return datetime.datetime.strptime(string, '%Y-%m-%dT%H:%M:%SZ')
File "/usr/local/lib/python3.7/_strptime.py", line 577, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
File "/usr/local/lib/python3.7/_strptime.py", line 359, in _strptime
(data_string, format))
ValueError: time data '' does not match format '%Y-%m-%dT%H:%M:%SZ'
23:48:49: Exception on /0/data/jobs/default/queued/8/1.json [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/rq/utils.py", line 169, in utcparse
return datetime.datetime.strptime(string, _TIMESTAMP_FORMAT)
File "/usr/local/lib/python3.7/_strptime.py", line 577, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
File "/usr/local/lib/python3.7/_strptime.py", line 359, in _strptime
(data_string, format))
ValueError: time data '' does not match format '%Y-%m-%dT%H:%M:%S.%fZ'
I add the jobs as follows:
from redis import Redis
from rq import Queue
from rq_scheduler import Scheduler
from datetime import datetime
import functions
tables = [["materialen", 2260, "artikelcode"], ["contracten", 4200, "contractnummer"], ["klantgegevens", 101, "klantnummer"], ["servicebonnen", 3600, "servicebonnummer"], [
"contactpersonen", 105, "klantnummer"], ["archief", 3900, "servicebonnummer"], ["documenten", 4240, "volgnummer"], ["memos", 3609, "servicebonnummer"]]
# Get a scheduler for the "default" queue
scheduler = Scheduler(connection=Redis('127.0.0.1'))
for tableInfo in tables:
scheduler.schedule(
scheduled_time=datetime.utcnow(),
timeout=120,
description=tableInfo[0],
func=functions.updateTable,
args=[tableInfo],
interval=60,
repeat=None,
)
I can't figure out what I'm doing wrong? What variable is empty or do I set the scheduled time incorrectly?
The issue is because rq-dashboard relies on rq v1.3.0 and it looks like it has some API differences from rq v1.4.0+.
So, ideally this should be fixed by rq-dashboard maintainers. Here is an opened issue and a pending PR that's mentioned there: https://github.com/Parallels/rq-dashboard/issues/362
Related
from Bio.PDB import *
import nglview as nv
import ipywidgets
pdb_parser = PDBParser()
structure = pdb_parser.get_structure("PHA-L", "C:\\Users\\asus\\Downloads\\1FAT.pdb")
view = nv.show_biopython(structure)
I was Expecting a plot of the protein structure
Below are the tracebacks
Traceback (most recent call last):
File "C:\Python311\Lib\site-packages\flask\app.py", line 2525, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\flask\app.py", line 1822, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\flask\app.py", line 1820, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\flask\app.py", line 1796, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\asus\Desktop\Rscripts\app.py", line 15, in view
pdbview(path_file)
File "C:\Users\asus\Desktop\Rscripts\mol.py", line 12, in pdbview
r.source(path+"NGLviewer.R")
^^^^^^^^
File "C:\Python311\Lib\site-packages\rpy2\robjects\__init__.py", line 434, in __getattribute__
return self.__getitem__(attr)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\rpy2\robjects\__init__.py", line 440, in __getitem__
res = conversion.get_conversion().rpy2py(res)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\functools.py", line 909, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\rpy2\robjects\conversion.py", line 252, in _rpy2py
raise NotImplementedError(
NotImplementedError: Conversion 'rpy2py' not defined for objects of type '<class 'rpy2.rinterface.SexpClosure'>'
127.0.0.1 - - [28/Nov/2022 13:39:11] "GET / HTTP/1.1" 500 -
Im working with the Thirdweb Python SDK API. The code below sometimes work and sometimes throws a gasprice issue. I think it could be a network issue, because it works sometimes and generates the NFT but not always.
And when i got an error it is about gasprice. But in the Thirdweb API doesnt appear a gasprice argument or someting like this.
Any ideas?
Code:
sqlcol="SELECT ID,(SELECT contrato FROM colecciones WHERE ID=idcolec) AS contratonft FROM solicitudcert WHERE ID='" + idsolicitud + "' LIMIT 0, 1"
mycursor.execute(sqlcol)
misolicitud = mycursor.fetchone()
if(misolicitud):
contratonft_aux=str(misolicitud[1])
contratonft=contratonft_aux.replace('"','')
sdk = ThirdwebSDK.from_private_key(PRIVATE_KEY, NETWORK)
NFT_COLLECTION_ADDRESS = contratonft
nft_collection = sdk.get_nft_collection(NFT_COLLECTION_ADDRESS)
urlarchivoarr=imagencert.split("/")
urlarchivostr=str(urlarchivoarr[1]);
urlarchivoimg="https://files.avfenixrecords.com/" + urlarchivostr
# You can pass in any address here to mint the NFT to
tx = nft_collection.mint(NFTMetadataInput.from_json({
"name": nombrecert,
"description": descripcert,
"image": urlarchivoimg
}))
idnft=tx.id
return jsonify({'status':'OK','IDNFT':idnft})
else:
return jsonify({'status':'ERROR','IDNFT':"NULL"})
Error:
[2022-11-15 19:54:21,628] ERROR in app: Exception on /api/contracts/v1/mintnft [POST]
Traceback (most recent call last):
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/flask/app.py", line 2525, in wsgi_app
response = self.full_dispatch_request()
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/flask/app.py", line 1822, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/flask/app.py", line 1820, in full_dispatch_request
rv = self.dispatch_request()
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/flask/app.py", line 1796, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "app.py", line 1851, in mintnft
tx = nft_collection.mint(NFTMetadataInput.from_json({
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/thirdweb/contracts/nft_collection.py", line 135, in mint
return self.mint_to(self._contract_wrapper.get_signer_address(), metadata)
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/thirdweb/contracts/nft_collection.py", line 166, in mint_to
receipt = self._contract_wrapper.send_transaction("mint_to", [to, uri])
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/thirdweb/core/classes/contract_wrapper.py", line 113, in send_transaction
tx = getattr(self._contract_abi, fn).build_transaction(
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/thirdweb/abi/token_erc721.py", line 1638, in build_transaction
return self._underlying_method(to, uri).buildTransaction(
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/web3/contract.py", line 1079, in buildTransaction
return build_transaction_for_function(
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/web3/contract.py", line 1648, in build_transaction_for_function
prepared_transaction = fill_transaction_defaults(web3, prepared_transaction)
File "cytoolz/functoolz.pyx", line 249, in cytoolz.functoolz.curry.__call__
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/web3/_utils/transactions.py", line 114, in fill_transaction_defaults
default_val = default_getter(web3, transaction)
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/web3/_utils/transactions.py", line 60, in <lambda>
'gas': lambda web3, tx: web3.eth.estimate_gas(tx),
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/web3/eth.py", line 825, in estimate_gas
return self._estimate_gas(transaction, block_identifier)
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/web3/module.py", line 57, in caller
result = w3.manager.request_blocking(method_str,
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/web3/manager.py", line 198, in request_blocking
return self.formatted_response(response,
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/web3/manager.py", line 171, in formatted_response
raise ValueError(response["error"])
ValueError: {'code': -32000, 'message': 'err: max fee per gas less than block base fee: address 0x98E0463643b28E24223d2B5EF19E78A9AF031505, maxFeePerGas: 70565183066 baseFee: 77047968359 (supplied gas 22141296)'}
I tried to modify the contracts config into the thirdweb dashboard without success.
What network are you seeing this issue on? We can add in a method to manually overwrite gas limits in the SDK.
I had a code of around 287 lines, when it is executed on command prompt everything works fine, but when it is compiled on localhost with Flask it is showing following error:
ERROR:series-api:Exception on /papis/get-series [GET]
Traceback (most recent call last):
File "C:\Users\mkiak\AppData\Roaming\Python\Python39\site-packages\flask\app.py", line 2070, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\mkiak\AppData\Roaming\Python\Python39\site-packages\flask\app.py", line 1515, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\mkiak\AppData\Roaming\Python\Python39\site-packages\flask\app.py", line 1513, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\mkiak\AppData\Roaming\Python\Python39\site-packages\flask\app.py", line 1499, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "E:\series-api.py", line 275, in getSeries
return jsonify(result)
File "C:\Users\mkiak\AppData\Roaming\Python\Python39\site-packages\flask\json\__init__.py", line 348, in jsonify
f"{dumps(data, indent=indent, separators=separators)}\n",
File "C:\Users\mkiak\AppData\Roaming\Python\Python39\site-packages\flask\json\__init__.py", line 129, in dumps
rv = _json.dumps(obj, **kwargs)
File "C:\Program Files\Python39\lib\json\__init__.py", line 234, in dumps
return cls(
File "C:\Program Files\Python39\lib\json\encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "C:\Program Files\Python39\lib\json\encoder.py", line 257, in iterencode
return _iterencode(o, 0)
ValueError: Circular reference detected
You have a reference to object inside the object itself. Minimal example:
import json
d = {}
d["a"] = d
json.dumps(d) # raises ValueError: Circular reference detected
You can try to create a (deep) copy of the object.
d = {}
d["a"] = d.copy()
json.dumps(d)
I'm currently porting a web app to Google App Engine, Python 3, Standard Environment. (So I'm new to GAE and NDB).
I have a bug here that I don't understand. I obtain an entity like so, the adjust properties, then save.
sourceUsers = User.query().filter(User.email == request.form.get('sourceUserEmail')).fetch(1)
if sourceUsers:
sourceUser = sourceUsers[0]
# manipulation:
sourceUser.sentInvitationSubscriptionKeys.append(subscription.key)
# verify key:
assert sourceUser.key != None
sourceUser.put()
But the saving triggers the following traceback:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2463, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2449, in wsgi_app
response = self.handle_exception(e)
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1866, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/Users/yanone/Code/Google App Engine/typeworldappengine/main.py", line 500, in api
sourceUser.put()
File "/usr/local/lib/python3.7/site-packages/google/cloud/ndb/_options.py", line 89, in wrapper
return wrapped(*pass_args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/google/cloud/ndb/utils.py", line 78, in wrapper
return wrapped(*args, **new_kwargs)
File "/usr/local/lib/python3.7/site-packages/google/cloud/ndb/utils.py", line 109, in positional_wrapper
return wrapped(*args, **kwds)
File "/usr/local/lib/python3.7/site-packages/google/cloud/ndb/model.py", line 4914, in _put
return self._put_async(_options=kwargs["_options"]).result()
File "/usr/local/lib/python3.7/site-packages/google/cloud/ndb/tasklets.py", line 190, in result
self.check_success()
File "/usr/local/lib/python3.7/site-packages/google/cloud/ndb/tasklets.py", line 137, in check_success
raise self._exception
File "/usr/local/lib/python3.7/site-packages/google/cloud/ndb/tasklets.py", line 312, in _advance_tasklet
yielded = self.generator.send(send_value)
File "/usr/local/lib/python3.7/site-packages/google/cloud/ndb/model.py", line 4974, in put
ds_entity = _entity_to_ds_entity(self)
File "/usr/local/lib/python3.7/site-packages/google/cloud/ndb/model.py", line 722, in _entity_to_ds_entity
names = prop._to_datastore(entity, data)
File "/usr/local/lib/python3.7/site-packages/google/cloud/ndb/model.py", line 2063, in _to_datastore
value = self._get_base_value_unwrapped_as_list(entity)
File "/usr/local/lib/python3.7/site-packages/google/cloud/ndb/model.py", line 1551, in _get_base_value_unwrapped_as_list
wrapped = self._get_base_value(entity)
File "/usr/local/lib/python3.7/site-packages/google/cloud/ndb/model.py", line 1537, in _get_base_value
return self._apply_to_values(entity, self._opt_call_to_base_type)
File "/usr/local/lib/python3.7/site-packages/google/cloud/ndb/model.py", line 1834, in _apply_to_values
value[:] = map(function, value)
File "/usr/local/lib/python3.7/site-packages/google/cloud/ndb/model.py", line 1612, in _opt_call_to_base_type
value = _BaseValue(self._call_to_base_type(value))
File "/usr/local/lib/python3.7/site-packages/google/cloud/ndb/model.py", line 1671, in _call_to_base_type
return call(value)
File "/usr/local/lib/python3.7/site-packages/google/cloud/ndb/model.py", line 1801, in call
new_value = method(self, value)
File "/usr/local/lib/python3.7/site-packages/google/cloud/ndb/model.py", line 3344, in _validate
"Expected Key, got {!r}".format(value)
google.cloud.ndb.exceptions.BadValueError: Expected Key, got None
In the debugging, I even made sure that the entity has a key (assert sourceUser.key != None). So I really don't get it. What am I doing wrong?
Mind you, all other entities save fine. Just this one doesn't.
Thank you.
I dont think this entity's primary key is the problem. It's probably another Key field on the object.
Whats the schema for the rest of you User object?
I have a piece of code as below python code:-
with multiprocessing.Manager() as manager:
L = manager.list()
number_processes = int(max(min(multiprocessing.cpu_count(), math.ceil(len(splittedFrames)/10.0)),1))
pool = multiprocessing.Pool(number_processes)
workFunc = partial(multiProcWork, dictMVUserMapping, diColMapping, L)
results = pool.map_async(workFunc, splittedFrames)
results.get()
pool.close()
pool.join()
# print L
masterDictList = [x for x in L]
Which fails with below error:-
Traceback (most recent call last):
File "/home/wiproadmin/Python2713/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/home/wiproadmin/Python2713/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/wiproadmin/Python2713/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/wiproadmin/Python2713/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/home/wiproadmin/Python2713/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "app.py", line 138, in setMvMappingFields
data = fn.uiDriverFunction(userMapping,token,username,provName=providerName)
File "../bin/functionsForUI.py", line 499, in uiDriverFunction
with multiprocessing.Manager() as manager:
File "/home/wiproadmin/Python2713/lib/python2.7/multiprocessing/__init__.py", line 99, in Manager
m.start()
File "/home/wiproadmin/Python2713/lib/python2.7/multiprocessing/managers.py", line 524, in start
self._process.start()
File "/home/wiproadmin/Python2713/lib/python2.7/multiprocessing/process.py", line 130, in start
self._popen = Popen(self)
File "/home/wiproadmin/Python2713/lib/python2.7/multiprocessing/forking.py", line 121, in __init__
self.pid = os.fork()
File "/home/wiproadmin/Python2713/lib/python2.7/site-packages/gevent/os.py", line 419, in fork
return fork_and_watch(*args, **kwargs)
File "/home/wiproadmin/Python2713/lib/python2.7/site-packages/gevent/os.py", line 375, in fork_and_watch
watcher = loop.child(pid, ref=ref)
File "gevent.libev.corecext.pyx", line 518, in gevent.libev.corecext.loop.child (src/gevent/libev/gevent.corecext.c:7603)
File "gevent.libev.corecext.pyx", line 1886, in gevent.libev.corecext.child.__init__ (src/gevent/libev/gevent.corecext.c:21688)
TypeError: child watchers are only available on the default loop
Which is working fine in windows and failing in ubuntu machine version 14.04, Tried searching around, couldnt find any information.