Alberto GZ Posted April 27, 2017 Report Share Posted April 27, 2017 Sometimes any job is frozen in running status. There is possible manage (delete) jobs from the client side? Maybe using api? Link to comment Share on other sites More sharing options...
Alberto GZ Posted April 27, 2017 Author Report Share Posted April 27, 2017 I see in documentation the example for create job with session.create() session.delete() for delete? http://ftrack-python-api.rtd.ftrack.com/en/stable/example/job.html Link to comment Share on other sites More sharing options...
Lucas Correia Posted April 27, 2017 Report Share Posted April 27, 2017 It is currently not possible to mark jobs as failed or delete them through the web interface, but it is possible using the (new) API. Here is an example which shows how to clear long-running jobs using the API. Regards, Lucas Link to comment Share on other sites More sharing options...
Alberto GZ Posted April 27, 2017 Author Report Share Posted April 27, 2017 Thank you Lucas! One question more... How I could to use multiple session configurations for the same mark_stalled_jobs_as_failed.py? I've tried with two external confs and alternating both as import config.py but I have problems with credentials using config2.py. There is another way to do this? I mean, can execute this script for two different ftrack-servers (at same time or not). config1.py import os os.environ['FTRACK_SERVER'] = 'ftrack-server-1' os.environ['FTRACK_APIKEY'] = 'api-key-1' os.environ['LOGNAME'] = 'user-1' config2.py import os os.environ['FTRACK_SERVER'] = 'ftrack-server-2' os.environ['FTRACK_APIKEY'] = 'api-key-2' os.environ['LOGNAME'] = 'user-2' Link to comment Share on other sites More sharing options...
Lucas Correia Posted April 28, 2017 Report Share Posted April 28, 2017 Yes, that should be possible. The script initializes the session without specifying server URL or API credentials, so it will pick up those from environment variables. (see Understanding sessions - connection, Environment variables). Note that the environment variables you set are for the legacy API. These work for the new API as well, but should the environment variables for the new API be set (FTRACK_API_USER, FTRACK_API_KEY) be set they will take precedence. session = ftrack_api.Session() You can e.g. set the environment variables in your shell before executing the script, or create a new python script (like the ones you have) which sets the credentials and then sources (imports) mark_stalled_jobs_as_failed. Regards, Lucas Link to comment Share on other sites More sharing options...
Alberto GZ Posted April 28, 2017 Author Report Share Posted April 28, 2017 I've updated environment variables for new API in my conf files. However, can't achieve this script (others too) works for multiple ftrack servers at same time. It would be possible set up environment vars listening multiple servers? Link to comment Share on other sites More sharing options...
Lucas Correia Posted April 28, 2017 Report Share Posted April 28, 2017 I am not sure if I am understanding your question correctly. You can use the new API against multiple ftrack servers. You could do this by passing the credentials directly: session_server_1 = ftrack_api.Session(server_url='https://server-1.ftrackapp.com', ...) session_server_2 = ftrack_api.Session(server_url='https://server-2.ftrackapp.com', ...) By setting the credentials in your environment/shell: # Execute script using server-1 export FTRACK_SERVER=https://server-1.ftrackapp.com export FTRACK_API_USER=john.doe@example.org export FTRACK_API_KEY=cb268ecc-8809-11a3-a7e2-20c9d081909b python my_script.py # Execute script using server-2 export FTRACK_SERVER=https://server-2.ftrackapp.com export FTRACK_API_USER=jane.doe@example.org export FTRACK_API_KEY=3a372bde-15bc-11e4-8908-20c9d081909b python my_script.py Or by setting them as environment variables within a python script (like in your examples) and then creating a session. Link to comment Share on other sites More sharing options...
Alberto GZ Posted April 28, 2017 Author Report Share Posted April 28, 2017 Yes, that's my question. If I set a unique config.py with same as in example code, then run only for the last environment var entries. I've using import config.py in my_script.py import os #ftrack-server-1 os.environ['FTRACK_SERVER'] = 'https://server-1.ftrackapp.com' os.environ['FTRACK_API_KEY'] = 'api-key-1' os.environ['FTRACK_API_USER'] = 'user-1' #ftrack-server-2 os.environ['FTRACK_SERVER'] = 'https://server-2.ftrackapp.com' os.environ['FTRACK_API_KEY'] = 'api-key-2' os.environ['FTRACK_API_USER'] = 'user-2' Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.