@@ -234,7 +234,7 @@ Currently, getting the program and job ids can only be done through the
234234You can then use ` get_program ` and ` get_job ` to retrieve the results.
235235See below for an example:
236236
237- ```
237+ ``` python
238238# Initialize the engine object
239239engine = cirq.google.Engine(project_id = ' YOUR_PROJECT_ID' )
240240
@@ -273,4 +273,52 @@ historical_results = historical_job.results()
273273```
274274
275275If you did not save the ids, you can still find them from your
276- job using the [ Cloud Console] ( https://console.cloud.google.com/quantum/jobs ) .
276+ job using the [ Cloud Console] ( https://console.cloud.google.com/quantum/jobs ) or
277+ by using our list methods.
278+
279+
280+ ### Listing jobs
281+
282+ To list the executions of your circuit, i.e. the jobs, you can use ` cirq.google.Engine.list_jobs() ` .
283+ You can search in all the jobs within your project using filtering criteria on creation time, execution state and labels.
284+
285+ ``` python
286+ from cirq.google.engine.client.quantum import enums
287+
288+ # Initialize the engine object
289+ engine = cirq.google.Engine(project_id = ' YOUR_PROJECT_ID' )
290+
291+ # List all the jobs on the project since 2020/09/20 that succeeded:
292+ jobs = engine.list_jobs(created_after = datetime.date(2020 ,9 ,20 ),
293+ execution_states = [enums.ExecutionStatus.State.SUCCESS ])
294+ for j in jobs:
295+ print (j.job_id, j.status(), j.create_time())
296+ ```
297+
298+ ### Listing programs
299+
300+ To list the different instances of your circuits uploaded, i.e. the programs, you can use ` cirq.google.Engine.list_programs() ` .
301+ Similar to jobs, filtering makes it possible to list programs by creation time and labels.
302+ With an existing ` cirq.google.EngineProgram ` object, you can list any jobs that were run using that program.
303+
304+ ``` python
305+ from cirq.google.engine.client.quantum import enums
306+
307+ # Initialize the engine object
308+ engine = cirq.google.Engine(project_id = ' YOUR_PROJECT_ID' )
309+
310+ # List all the programs on the project since 2020/09/20 that have
311+ # the "variational" label with any value and the "experiment" label
312+ # with value "vqe001":
313+ programs = engine.list_programs(
314+ created_after = datetime.date(2020 ,9 ,20 ),
315+ has_labels = {" variational" :" *" , " experiment" :" vqe001" }
316+ )
317+ for p in programs:
318+ print (p.program_id, p.create_time())
319+ # the same filtering parametrization is available as in engine.list_jobs()
320+ # for example here we list the jobs under the programs that failed
321+ for j in p.list_jobs(execution_states = [enums.ExecutionStatus.State.FAILURE ]):
322+ print (j.job_id, j.status())
323+ ```
324+
0 commit comments