kim-a

Members
  • Content Count

    8
  • Joined

  • Last visited

About kim-a

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Is there a plan to publish action events to amqp at some point? This would be very useful for integration with tools like Celery.
  2. kim-a

    Unpersisted operation

    I will try... It might be a little difficult to create a minimal example here, because this has arisen in a rather complex scenario. (Note: I have a support ticket open for this as well.) The basic setup is this: I have a PyQt app with a UI. All of the Ftrack operations are carried out by a worker class called FtrackWorker, which lives on a secondary thread spawned and maintained by a QThread. FtrackWorker and the main window communicate via signals. The FtrackWorker class queries Ftrack for data to display in the UI. Once the user selects some asset versions from the UI, the worker calls a CopyAsset class to copy the contents of that asset to another project in Ftrack and on disk. It is after the completion of that copy that the unpersisted operation appears.
  3. kim-a

    Unpersisted operation

    Recently, I have noticed a leftover recorded operation after publishing new asset versions. When I print the contents of the operation, it looks something like this: {'old_value': Symbol(NOT_SET), 'new_value': Symbol(NOT_SET), 'entity_key': OrderedDict([('id', <id hash>)]), 'attribute_name': u'components', 'entity_type': u'AssetVersion'} If my script publishes multiple versions in a row, the id hash always matches the last version published to the database. What is going on here? It seems odd that the old and new values are NOT_SET. We are currently using Ftrack Python API version 1.0.4.
  4. Hi folks, My company has just updated our installation of Ftrack, and I would like to take advantage of the new features for linking dependencies in my code, specifically the AssetVersionLink entity. Can you please provide a use case that can illustrate some of the properties of this entity? How does it differ from usesVersions()? Is it supposed to replace it, or are we supposed to use them in tandem? There is no documentation on this feature, so any information would be very helpful. Thanks, Kim
  5. I am having a similar issue with custom attributes at the project level. What I am finding is that it is possible to set new values for the custom attribute indefinitely until I use a get method to extract the value that has been set. Once a get method is called, the custom attribute value is frozen in place. However, this only happens upon calling the session commit (judging from my debug session). So let's say my set and get methods look like this: def setLocations(self, ent, locs): # locs is a list of locations # ent is a project # all locs are vetted against options in the locations enumerator first ent['custom_attributes']['locations'] = locs self.session.commit() @staticmethod def getLocations(ent): locs = ent['custom_attributes']['locations'] return locs And suppose I have a unit test for the functions above. Here are 2 alternate versions of the unit test (obviously, the first one passes and the second one fails): def test_passes(self): locs1 = ["mars", "venus"] locs2 = ["mars", "jupiter", "venus"] locs3 = ["mars", "jupiter", "venus", "mercury"] api.setLocations(my_proj, locs1) api.setLocations(my_proj, locs2) api.setLocations(my_proj, locs3) proj_locs = api.getLocations(my_proj) self.assertEqual(proj_locs, locs3) def test_fails(self): locs1 = ["mars", "venus"] locs2 = ["mars", "jupiter", "venus"] locs3 = ["mars", "jupiter", "venus", "mercury"] api.setLocations(my_proj, locs1) proj_locs1 = api.getLocations(my_proj) api.setLocations(my_proj, locs2) proj_locs2 = api.getLocations(my_proj) api.setLocations(my_proj, locs3) proj_locs3 = api.getLocations(my_proj) self.assertEqual(proj_locs1, locs1) self.assertEqual(proj_locs2, locs2) self.assertEqual(proj_locs3, locs3) When I run this through pdb, everything appears to be setting correctly until I pass the commit line in setLocations (i.e. if I check the value of ent['custom_attributes']['locations'] after setting it but before committing it). Then the getLocation returns the first entry. Thoughts?
  6. I realize that my post was not entirely clear--that's not what I want to query. I want to know what options are available to use for a particular custom field when creating a project. So let's say we have a custom field called "location" for projects, which is an enumerator type. I want to be able to create projects and set their locations in the process. In order to do this, I need to query what values exist in the location enumerator. I shouldn't be able to set a location for the project that doesn't exist. I also posted this question as a separate post here:
  7. What about querying for the contents of specific custom attributes? You cite the below example to return a list of all of the attributes. >>> session.query('CustomAttributeConfiguration').all() Does non-hierarchical in this situation mean that you can't go any deeper than the list of custom attributes?
  8. In our Ftrack installation, we have defined a custom attribute at the project level--let's call it "locations". I would like to create a function that allows users to add an additional location to a project after querying that the provided argument is indeed an available option in the collection of locations. I can't find an example of this kind of query; I just need to know whether this is something attached to Session or somewhere else. So let's say locations = {'Uptown': 'uptown', 'Downtown': 'downtown', 'Midtown': 'midtown'} (in settings it's an Enumerator that seems to be represented as a dictionary) We created our own wrappers for some of several of the Ftrack queries, so I decided not to include that code. The part in bold is what I'm getting at... is this the way to access it? I thought this might be the way because the documentation says: "The custom attributes available on entities are cached on the Session." It isn't working when I run unit tests.