maganaluis commented on a change in pull request #8256: URL: https://github.com/apache/airflow/pull/8256#discussion_r419189015
########## File path: airflow/operators/python_operator.py ########## @@ -330,13 +330,28 @@ def _write_string_args(self, filename): def _write_args(self, input_filename): # serialize args to file + if self.use_dill: + serializer = dill + else: + serializer = pickle + # some args from context can't be loaded in virtual env + invalid_args = set(['dag', 'task', 'ti']) if self._pass_op_args(): + kwargs = {} + for key, value in self.op_kwargs.items(): Review comment: @Fokko Thank you for taking time to review this PR, I've updated it based on your suggestions. ```python def _write_args(self, input_filename): # serialize args to file if self.use_dill: serializer = dill else: serializer = pickle # some items from context can't be loaded in virtual env # see pr https://github.com/apache/airflow/pull/8256 not_serializable = {'dag', 'task', 'ti', 'macros', 'task_instance', 'var'} if self._pass_op_args(): kwargs = {key: value for key, value in self.op_kwargs.items() if key not in not_serializable} with open(input_filename, 'wb') as f: arg_dict = ({'args': self.op_args, 'kwargs': kwargs}) serializer.dump(arg_dict, f) ```` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org