TypeError: Object of type 'DSSProject' is not JSON serializable

dataikubest
Level 2
TypeError: Object of type 'DSSProject' is not JSON serializable

I'm trying to use custom python step on scenario to create a bundle and deploy to project deployer.

import dataiku
from datetime import datetime

client = dataiku.api_client() # get DSS client
deployer = client.get_projectdeployer() # get project deployer

project =  client.get_project(dataiku.default_project_key()) # get cross sell model project
global_vars = project.get_variables() # get project variables
bundle_id = global_vars['standard']['bundle_id'] # get bundle_id from project variable

#create bundle
project.export_bundle(bundle_id)

# create deployment and deploy a bundle
project_id = 'my-model-name'
infra_id = 'qa-automation'

deployment_id = '%s-%s-on-%s' % (project_id, bundle_id, infra_id)
deployment = deployer.create_deployment(deployment_id, project, infra_id, bundle_id)

 

But this throws 

TypeError: Object of type 'DSSProject' is not JSON serializable

 

Has anyone gone through this before?

Thanks in advance


Operating system used: linux

0 Kudos
1 Reply
Turribeach

I believe you need to pass the project_key (in your case project_id) to the create_deployment method:

deployment = deployer.create_deployment(deployment_id, project_id, infra_id, bundle_id)

 https://developer.dataiku.com/latest/api-reference/python/project-deployer.html#dataikuapi.dss.proje...

What you are passing is the project handle. 

0 Kudos