我正在尝试修改Airflow的dataproc运算符,以将Anaconda和Jupyter包括到集群中。
我要覆盖DataprocClusterCreateOperator
以包括optionalComponents
。
阅读Google docs后,我了解到我需要通过一个枚举。
每次我尝试运行此任务时,都会遇到无效的值错误或TypeError: Object of type 'EnumMeta' is not JSON serializable
如果有人能告诉我如何正确输入此字段,我将非常感谢。
cluster_data = {
'projectId': self.project_id,'clusterName': self.cluster_name,'config': {
'gceclusterConfig': {
},'masterConfig': {
'numInstances': self.num_masters,'machineTypeUri': master_type_uri,'diskConfig': {
'bootDiskType': self.master_disk_type,'bootDiskSizeGb': self.master_disk_size
}
},'workerConfig': {
'numInstances': self.num_workers,'machineTypeUri': worker_type_uri,'diskConfig': {
'bootDiskType': self.worker_disk_type,'bootDiskSizeGb': self.worker_disk_size
}
},'secondaryWorkerConfig': {},'softwareConfig': {
# I've tried the following:
'optionalComponents': 'ANACONDA,JUPYTER'
#from google.cloud.dataproc_v1 import enums
'optionalComponents': [enums.Component.ANACONDA.value]
},}
}