Flink 1.15.1 Checkpoint Problem with gRPC - apache-flink

I am trying to understand the Flink Checkpointing system (in PyFlink). This is why I created a playground for it. Here is my environment
env = StreamExecutionEnvironment.get_execution_environment()
config = Configuration(j_configuration=get_j_env_configuration(env._j_stream_execution_environment))
config.set_integer("python.fn-execution.bundle.size", 1000)
env.set_runtime_mode(RuntimeExecutionMode.STREAMING)
env.enable_checkpointing(3000)
env.get_checkpoint_config().set_checkpointing_mode(CheckpointingMode.AT_LEAST_ONCE)
env.get_checkpoint_config().set_checkpoint_storage(FileSystemCheckpointStorage('file:///home/ubuntu/checkpoints'))
env.get_checkpoint_config().set_fail_on_checkpointing_errors(True)
env.get_checkpoint_config().set_tolerable_checkpoint_failure_number(1)
and I use state with a simple map function as
class RandomRaiserMap(MapFunction):
def open(self, runtime_context: RuntimeContext):
state_desc = ValueStateDescriptor('cnt', Types.INT())
self.cnt_state = runtime_context.get_state(state_desc)
def map(self, value: Row):
cnt = self.cnt_state.value()
self.cnt_state.update(1 if cnt is None else cnt + 1)
if random.random() < 0.001:
raise Exception("Planted")
return Row(count=self.cnt_state.value(), **value.as_dict())
I used Kafka source (FlinkKafkaConsumer) as
deserialization_schema = JsonRowDeserializationSchema.builder() \
.type_info(Types.ROW_NAMED(["seq", "payload", "event_time"], [Types.INT(), Types.STRING(), Types.SQL_TIMESTAMP()])).build()
source = FlinkKafkaConsumer(
topics='test_checkpoint_sequence_2',
deserialization_schema=deserialization_schema,
properties={'bootstrap.servers': 'localhost:9092'}
)
Now, when start to execute job,
3> +I[1,273328,23fe377010c55a18,2022-08-02 12:36:50.325000]
3> +I[2,273329,79782a6af4a9badb,2022-08-02 12:36:50.336000]
3> +I[3,273330,d3537b0b9aedf6f9,2022-08-02 12:36:50.348000]
3> +I[4,273331,d600824835e4f04d,2022-08-02 12:36:50.359000]
3> +I[5,273332,e1e0851bfbe743ab,2022-08-02 12:36:50.370000]
3> +I[6,273333,27a547b6d4469ac0,2022-08-02 12:36:50.381000]
3> +I[7,273334,f12da6dbccbfc1be,2022-08-02 12:36:50.392000]
Exception in thread read_grpc_client_inputs:
Traceback (most recent call last):
File "/home/ubuntu/miniconda3/envs/py38/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/home/ubuntu/miniconda3/envs/py38/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/ubuntu/miniconda3/envs/py38/lib/python3.8/site-packages/apache_beam/runners/worker/data_plane.py", line 598, in <lambda>
target=lambda: self._read_inputs(elements_iterator),
File "/home/ubuntu/miniconda3/envs/py38/lib/python3.8/site-packages/apache_beam/runners/worker/data_plane.py", line 581, in _read_inputs
for elements in elements_iterator:
File "/home/ubuntu/miniconda3/envs/py38/lib/python3.8/site-packages/grpc/_channel.py", line 426, in __next__
return self._next()
File "/home/ubuntu/miniconda3/envs/py38/lib/python3.8/site-packages/grpc/_channel.py", line 826, in _next
raise self
grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with:
status = StatusCode.CANCELLED
details = "Multiplexer hanging up"
debug_error_string = "UNKNOWN:Error received from peer ipv6:%5B::1%5D:38775 {grpc_message:"Multiplexer hanging up", grpc_status:1, created_time:"2022-08-02T12:36:53.274140888+00:00"}"
>
Traceback (most recent call last):
File "/home/ubuntu/miniconda3/envs/py38/lib/python3.8/site-packages/apache_beam/runners/worker/data_plane.py", line 470, in input_elements
element = received.get(timeout=1)
File "/home/ubuntu/miniconda3/envs/py38/lib/python3.8/queue.py", line 178, in get
raise Empty
_queue.Empty
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ubuntu/miniconda3/envs/py38/lib/python3.8/site-packages/apache_beam/runners/worker/sdk_worker.py", line 289, in _execute
response = task()
File "/home/ubuntu/miniconda3/envs/py38/lib/python3.8/site-packages/apache_beam/runners/worker/sdk_worker.py", line 362, in <lambda>
lambda: self.create_worker().do_instruction(request), request)
File "/home/ubuntu/miniconda3/envs/py38/lib/python3.8/site-packages/apache_beam/runners/worker/sdk_worker.py", line 606, in do_instruction
return getattr(self, request_type)(
File "/home/ubuntu/miniconda3/envs/py38/lib/python3.8/site-packages/apache_beam/runners/worker/sdk_worker.py", line 644, in process_bundle
bundle_processor.process_bundle(instruction_id))
File "/home/ubuntu/miniconda3/envs/py38/lib/python3.8/site-packages/apache_beam/runners/worker/bundle_processor.py", line 988, in process_bundle
for element in data_channel.input_elements(instruction_id,
File "/home/ubuntu/miniconda3/envs/py38/lib/python3.8/site-packages/apache_beam/runners/worker/data_plane.py", line 473, in input_elements
raise RuntimeError('Channel closed prematurely.')
RuntimeError: Channel closed prematurely.
3> +I[188,273515,0fec22df999f7054,2022-08-02 12:36:52.362000]
3> +I[189,273516,9587bc4039b1b8d9,2022-08-02 12:36:52.373000]
3> +I[190,273517,e8e2d9dceb66ba15,2022-08-02 12:36:52.384000]
3> +I[191,273518,569c5513e994fa6b,2022-08-02 12:36:52.395000]
3> +I[192,273519,1f2809cd273204f9,2022-08-02 12:36:52.406000]
3> +I[193,273520,2f63560bdbeb2c96,2022-08-02 12:36:52.417000]
When a periodical checkpoint starts, I get this error. However, it manages to write a checkpoint on the given path (like 1f488f8d38f82d55cc342e1d0f676707) and if an error happens, it can recover as well. I am stuck with what the error can be.
I use
Ubuntu 22.04
Java 11
Python 3.8
Flink 1.15.1
apache-flink 1.15.1

Related

ODOO 12 server error regarding invoice sequencing

I am trying to change the sequence of my invoicing. Instead of resetting it each new year, I can keep the count going upwards continuously.
(for example)
inv/2021/0001 date 1/1/2023   (this one should be 2366)
inv/2021/2365    date 31/12/2022
researching on the subject I found out I need to go into technical -> sequences to get the invoice numbers I want.
but my problem is, once i click sequences I get the following server error:
Error:
Odoo Server Error
Traceback (most recent call last):
File "/odoo/odoo-server/odoo/api.py", line 1039, in get
value = self._data[key][field][record._ids[0]]
KeyError: 254
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/odoo/odoo-server/odoo/fields.py", line 981, in __get__
value = record.env.cache.get(record, self)
File "/odoo/odoo-server/odoo/api.py", line 1041, in get
raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: ('ir.sequence(254,).number_next_actual', None)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/odoo/odoo-server/odoo/http.py", line 656, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/odoo/odoo-server/odoo/http.py", line 314, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/odoo/odoo-server/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/odoo/odoo-server/odoo/http.py", line 698, in dispatch
result = self._call_function(**self.params)
File "/odoo/odoo-server/odoo/http.py", line 346, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/odoo/odoo-server/odoo/service/model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "/odoo/odoo-server/odoo/http.py", line 339, in checked_call
result = self.endpoint(*a, **kw)
File "/odoo/odoo-server/odoo/http.py", line 941, in __call__
return self.method(*args, **kw)
File "/odoo/odoo-server/odoo/http.py", line 519, in response_wrap
response = f(*args, **kw)
File "/odoo/odoo-server/addons/web/controllers/main.py", line 904, in search_read
return self.do_search_read(model, fields, offset, limit, domain, sort)
File "/odoo/odoo-server/addons/web/controllers/main.py", line 926, in do_search_read
offset=offset or 0, limit=limit or False, order=sort or False)
File "/odoo/odoo-server/odoo/models.py", line 4589, in search_read
result = records.read(fields)
File "/odoo/odoo-server/odoo/models.py", line 2791, in read
vals[name] = convert(record[name], record, use_name_get)
File "/odoo/odoo-server/odoo/models.py", line 5117, in __getitem__
return self._fields[key].__get__(self, type(self))
File "/odoo/odoo-server/odoo/fields.py", line 985, in __get__
self.determine_value(record)
File "/odoo/odoo-server/odoo/fields.py", line 1098, in determine_value
self.compute_value(recs)
File "/odoo/odoo-server/odoo/fields.py", line 1052, in compute_value
self._compute_value(records)
File "/odoo/odoo-server/odoo/fields.py", line 1043, in _compute_value
getattr(records, self.compute)()
File "/odoo/odoo-server/odoo/addons/base/models/ir_sequence.py", line 96, in _get_number_next_actual
seq.number_next_actual = _predict_nextval(self, seq_id)
File "/odoo/odoo-server/odoo/addons/base/models/ir_sequence.py", line 68, in _predict_nextval
self.env.cr.execute(query % {'seq_id': seq_id})
File "/odoo/odoo-server/odoo/sql_db.py", line 148, in wrapper
return f(self, *args, **kwargs)
File "/odoo/odoo-server/odoo/sql_db.py", line 225, in execute
res = self._obj.execute(query, params)
psycopg2.ProgrammingError: relation "ir_sequence_1000015" does not exist
LINE 6: FROM ir_sequence_1000015
I believe it could be a database error but I am not sure what this is about. Any idea?
Thanks!

odoo 14 connection to database failed

I do a clean Odoo 14 install and postgreSQL for a new Job, and I had this problem:
This is the odoo log file:
2022-09-26 22:08:19,881 4564 INFO ? odoo.sql_db: Connection to the database failed
2022-09-26 22:08:19,883 4564 INFO ? werkzeug: 127.0.0.1 - - [26/Sep/2022 22:08:19] "GET /favicon.ico HTTP/1.1" 500 - 0 0.000 0.019
2022-09-26 22:08:19,885 4564 ERROR ? werkzeug: Error on request:
Traceback (most recent call last):
File "D:\odoo\python\lib\site-packages\werkzeug\serving.py", line 306, in run_wsgi
execute(self.server.app)
File "D:\odoo\python\lib\site-packages\werkzeug\serving.py", line 294, in execute
application_iter = app(environ, start_response)
File "D:\odoo\server\odoo\service\server.py", line 441, in app
return self.app(e, s)
File "D:\odoo\server\odoo\service\wsgi_server.py", line 113, in application
return application_unproxied(environ, start_response)
File "D:\odoo\server\odoo\service\wsgi_server.py", line 88, in application_unproxied
result = odoo.http.root(environ, start_response)
File "D:\odoo\server\odoo\http.py", line 1328, in __call__
return self.dispatch(environ, start_response)
File "D:\odoo\server\odoo\http.py", line 1294, in __call__
return self.app(environ, start_wrapped)
File "D:\odoo\python\lib\site-packages\werkzeug\middleware\shared_data.py", line 220, in __call__
return self.app(environ, start_response)
File "D:\odoo\server\odoo\http.py", line 1479, in dispatch
self.setup_db(httprequest)
File "D:\odoo\server\odoo\http.py", line 1385, in setup_db
httprequest.session.db = db_monodb(httprequest)
File "D:\odoo\server\odoo\http.py", line 1567, in db_monodb
dbs = db_list(True, httprequest)
File "D:\odoo\server\odoo\http.py", line 1534, in db_list
dbs = odoo.service.db.list_dbs(force)
File "D:\odoo\server\odoo\service\db.py", line 384, in list_dbs
with closing(db.cursor()) as cr:
File "D:\odoo\server\odoo\sql_db.py", line 678, in cursor
return Cursor(self.__pool, self.dbname, self.dsn, serialized=serialized)
File "D:\odoo\server\odoo\sql_db.py", line 250, in __init__
self._cnx = pool.borrow(dsn)
File "D:\odoo\server\odoo\sql_db.py", line 561, in _locked
return fun(self, *args, **kwargs)
File "D:\odoo\server\odoo\sql_db.py", line 629, in borrow
**connection_info)
File "D:\odoo\python\lib\site-packages\psycopg2\__init__.py", line 127, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError - - -
I'm new in the world of database and coding... It seems a little problem but I do know how to resolve it. thanks for reading
Check the status of the postgresql service. It seems it has not started.
Check status:
sudo service postgresql status
Restart:
sudo service postgresql restart

Discord Error Loading JSON File: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

When i execute my code i receive next problem.Someone have a idea what i maked wrong in this code?
Ignoring exception in on_member_join
Traceback (most recent call last):
File "C:\Users\Adryan\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\client.py", line 270, in _run_event
await coro(*args, **kwargs)
File "C:\Users\Adryan\Desktop\bot\cogs\events.py", line 51, in on_member_join
users = json.load(f)
File "C:\Users\Adryan\AppData\Local\Programs\Python\Python37\lib\json\__init__.py", line 296, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "C:\Users\Adryan\AppData\Local\Programs\Python\Python37\lib\json\__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "C:\Users\Adryan\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\Adryan\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
async def on_member_join(self, member):
with open('users.json', 'r') as f:
users = json.load(f)

Google App Engine Error Unknown Task Queue

i just deployed the appengine application and when i do a rest get call to trigger the queue i am getting below UnknownQueueError. It appears that the exception is thrown at the the below source code line. Any ideas on what is causing the issue. I tested locally and it works perfectly fine.
q.add(task)
Exception
Exception on /tasks/stock/prices/dispatch [GET]
Traceback (most recent call last):
File "/base/data/home/apps/s~xxxxx-173913/internal-
api:20170716t091842.402709903291335684/lib/flask/app.py", line 1817,
in wsgi_app
response = self.full_dispatch_request()
File "/base/data/home/apps/s~xxxxx-173913/internal-
api:20170716t091842.402709903291335684/lib/flask/app.py", line 1477,
in full_dispatch_request
rv = self.handle_user_exception(e)
File "/base/data/home/apps/s~xxxx-173913/internal-
api:20170716t091842.402709903291335684/lib/flask/app.py", line 1381,
in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/base/data/home/apps/s~xxxxxx-173913/internal-
api:20170716t091842.402709903291335684/lib/flask/app.py", line 1475,
in full_dispatch_request
rv = self.dispatch_request()
File "/base/data/home/apps/s~xxxxxx-173913/internal-
api:20170716t091842.402709903291335684/lib/flask/app.py", line 1461,
in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/base/data/home/apps/s~xxxx-173913/internal-apixxx/
internal/tasks/stock_prices_dispa
tch.py", line 34, in run
q.add(task)
File"/base/data/home/runtimes/python27/python27_lib
/versions/1/google/appengine/api/taskqueue/taskqueue.py",
line 2128, in add
return self.add_async(task, transactional).get_result()
File"/base/data/home/runtimes/python27/python27_lib
/versions/1/google/appeng
ine/api/apiproxy_stub_map.py", line 613, in get_result
return self.__get_result_hook(self)
File "/base/data/home/runtimes/python27/
python27_lib/versions/1/google/appeng
ine/api/taskqueue/taskqueue.py", line 2162, in ResultHook
raise exception
UnknownQueueError
Source Code
task = Blueprint('tasks.stock.prices.dispatch', __name__)
#task.route('/tasks/stock/prices/dispatch')
def run():
q = taskqueue.Queue('push-queue')
from_date = request.args.get('from')
to_date = request.args.get('to')
with open(os.path.join(os.path.dirname(__file__),
"../resources/dow_30.csv")) as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
ticker = row['TICKER']
stock_code = row['StockCode']
task = taskqueue.Task(
url='/tasks/stock/prices/shard',
target='internal-api',
headers={'Content-Type' : 'application/json'},
payload=json.dumps({'ticker': ticker, 'stock_code': stock_code, 'from' : from_date, 'to' : to_date}))
logging.info("StockCode :=" + stock_code)
q.add(task)
return "OK"
When i deployed the application i forgot to deploy queue.yaml. Once i did the below ( provided by #DanCornilescu) it resolved the issue.
gcould app deploy <path_to_your_queue.yaml>

AttributeError: 'NoneType' object has no attribute 'wrap_socket' in GAE

I am try to fetch some tweets in Google App Engine and doing some analysis on that tweets.
Due to some issue in urllib3, I am facing the following error :
AttributeError: 'NoneType' object has no attribute 'wrap_socket'
The last three call are :
File "/Users/krishna/Documents/DATASCI/twitterapi/analyzetweets/requests/packages/urllib3/connectionpool.py", line 304, in _make_request
self._validate_conn(conn)
File "/Users/krishna/Documents/DATASCI/twitterapi/analyzetweets/requests/packages/urllib3/connectionpool.py", line 722, in _validate_conn
conn.connect()
File "/Users/krishna/Documents/DATASCI/twitterapi/analyzetweets/requests/packages/urllib3/connection.py", line 164, in connect
self.sock = ssl.wrap_socket(conn, self.key_file, self.cert_file)
AttributeError: 'NoneType' object has no attribute 'wrap_socket'
Traceback (most recent call last):
INFO 2014-08-24 10:37:05,800 connectionpool.py:695] Starting new HTTPS connection (1): api.twitter.com
ERROR 2014-08-24 10:37:06,175 webapp2.py:1528] 'NoneType' object has no attribute 'wrap_socket'
Traceback (most recent call last):
File "/Users/krishna/google-cloud-sdk/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.3/webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "/Users/krishna/google-cloud-sdk/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.3/webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "/Users/krishna/google-cloud-sdk/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "/Users/krishna/google-cloud-sdk/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.3/webapp2.py", line 1077, in __call__
return handler.dispatch()
File "/Users/krishna/google-cloud-sdk/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.3/webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "/Users/krishna/google-cloud-sdk/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.3/webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "/Users/krishna/Documents/DATASCI/twitterapi/analyzetweets/main.py", line 50, in post
tweetTextCotainer = THandler.getTweetsText()
File "/Users/krishna/Documents/DATASCI/twitterapi/analyzetweets/main.py", line 82, in getTweetsText
access_token_secret = self.access_token_secret
File "/Users/krishna/Documents/DATASCI/twitterapi/analyzetweets/TwitterSearch/TwitterSearch.py", line 63, in __init__
self.authenticate(verify)
File "/Users/krishna/Documents/DATASCI/twitterapi/analyzetweets/TwitterSearch/TwitterSearch.py", line 83, in authenticate
r = requests.get(self._base_url + self._verify_url, auth=self.__oauth, proxies=self.__proxy)
File "/Users/krishna/Documents/DATASCI/twitterapi/analyzetweets/requests/api.py", line 55, in get
return request('get', url, **kwargs)
File "/Users/krishna/Documents/DATASCI/twitterapi/analyzetweets/requests/api.py", line 44, in request
return session.request(method=method, url=url, **kwargs)
File "/Users/krishna/Documents/DATASCI/twitterapi/analyzetweets/requests/sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "/Users/krishna/Documents/DATASCI/twitterapi/analyzetweets/requests/sessions.py", line 574, in send
r = adapter.send(request, **kwargs)
File "/Users/krishna/Documents/DATASCI/twitterapi/analyzetweets/requests/adapters.py", line 345, in send
timeout=timeout
File "/Users/krishna/Documents/DATASCI/twitterapi/analyzetweets/requests/packages/urllib3/connectionpool.py", line 516, in urlopen
body=body, headers=headers)
File "/Users/krishna/Documents/DATASCI/twitterapi/analyzetweets/requests/packages/urllib3/connectionpool.py", line 304, in _make_request
self._validate_conn(conn)
File "/Users/krishna/Documents/DATASCI/twitterapi/analyzetweets/requests/packages/urllib3/connectionpool.py", line 722, in _validate_conn
conn.connect()
File "/Users/krishna/Documents/DATASCI/twitterapi/analyzetweets/requests/packages/urllib3/connection.py", line 164, in connect
self.sock = ssl.wrap_socket(conn, self.key_file, self.cert_file)
AttributeError: 'NoneType' object has no attribute 'wrap_socket'
For posterity (full discussion available on GitHub):
The "ssl" library appeared to have issues with import, thus ssl = None.
Updating the app.yaml helped.
libraries:
- name: ssl
version: latest

Resources