10
10
11
11
from octue .cloud import storage
12
12
from octue .cloud .events .answer_question import answer_question
13
- from octue .cloud .events .replayer import EventReplayer
14
13
from octue .cloud .events .question import make_question_event
14
+ from octue .cloud .events .replayer import EventReplayer
15
15
from octue .cloud .events .validation import VALID_EVENT_KINDS
16
- from octue .cloud .pub_sub .bigquery import get_events , DEFAULT_EVENT_STORE_TABLE_ID
16
+ from octue .cloud .pub_sub .bigquery import DEFAULT_EVENT_STORE_TABLE_ID , get_events
17
17
from octue .cloud .pub_sub .service import Service
18
18
from octue .cloud .service_id import create_sruid , get_sruid_parts
19
19
from octue .cloud .storage import GoogleCloudStorageClient
32
32
33
33
34
34
@click .group (context_settings = {"help_option_names" : ["-h" , "--help" ]})
35
- @click .option (
36
- "--id" ,
37
- default = None ,
38
- type = click .UUID ,
39
- show_default = True ,
40
- help = "UUID of the analysis being undertaken. None (for local use) will cause a unique ID to be generated." ,
41
- )
42
35
@click .option ("--logger-uri" , default = None , show_default = True , help = "Stream logs to a websocket at the given URI." )
43
36
@click .option (
44
37
"--log-level" ,
47
40
show_default = True ,
48
41
help = "Log level used for the analysis." ,
49
42
)
50
- @click .option (
51
- "--force-reset/--no-force-reset" ,
52
- default = True ,
53
- is_flag = True ,
54
- show_default = True ,
55
- help = "Forces a reset of analysis cache and outputs [For future use, currently not implemented]" ,
56
- )
57
43
@click .version_option (version = LOCAL_SDK_VERSION )
58
- def octue_cli (id , logger_uri , log_level , force_reset ):
59
- """The CLI for the Octue SDK. Use it to start an Octue data service or digital twin locally or run an analysis on
60
- one locally.
44
+ def octue_cli (logger_uri , log_level ):
45
+ """The CLI for Octue SDKs and APIs, most notably Twined.
61
46
62
47
Read more in the docs: https://octue-python-sdk.readthedocs.io/en/latest/
63
48
"""
64
- global_cli_context ["analysis_id" ] = id
65
49
global_cli_context ["logger_uri" ] = logger_uri
66
50
global_cli_context ["log_handler" ] = None
67
51
global_cli_context ["log_level" ] = log_level .upper ()
68
- global_cli_context ["force_reset" ] = force_reset
69
52
70
53
apply_log_handler (log_level = log_level .upper ())
71
54
@@ -74,6 +57,12 @@ def octue_cli(id, logger_uri, log_level, force_reset):
74
57
75
58
76
59
@octue_cli .group ()
60
+ def twined ():
61
+ """The Twined CLI. Use it to ask questions to or start a Twined data service in the cloud or locally."""
62
+ pass
63
+
64
+
65
+ @twined .group ()
77
66
def question ():
78
67
"""Ask a new question to an Octue Twined data service or interact with a previous question."""
79
68
@@ -322,7 +311,7 @@ def get(
322
311
limit ,
323
312
service_config ,
324
313
):
325
- """Get the events emitted during a question as JSON. One of the following must be set:
314
+ r """Get the events emitted during a question as JSON. One of the following must be set:
326
315
327
316
--question-uuid\n
328
317
--parent-question-uuid\n
@@ -434,7 +423,7 @@ def replay(
434
423
exclude_logs_containing ,
435
424
validate_events ,
436
425
):
437
- """Replay a question's events, returning the result as JSON at the end if there is one. One of the following must be
426
+ r """Replay a question's events, returning the result as JSON at the end if there is one. One of the following must be
438
427
set:
439
428
440
429
--question-uuid\n
@@ -584,29 +573,7 @@ def diagnostics(cloud_path, local_path, download_datasets):
584
573
# child.cancel(question_uuid=question_uuid, event_store_table_id=service_configuration.event_store_table_id)
585
574
586
575
587
- @octue_cli .command (deprecated = True )
588
- @click .argument (
589
- "cloud_path" ,
590
- type = str ,
591
- )
592
- @click .option (
593
- "--local-path" ,
594
- type = click .Path (file_okay = False ),
595
- default = "." ,
596
- help = "The path to a directory to store the directory of diagnostics data in. Defaults to the current working "
597
- "directory." ,
598
- )
599
- @click .option (
600
- "--download-datasets" ,
601
- is_flag = True ,
602
- help = "If provided, download any datasets from the diagnostics and update their paths in the configuration and "
603
- "input manifests to the new local paths." ,
604
- )
605
- def get_diagnostics (cloud_path , local_path , download_datasets ):
606
- diagnostics (cloud_path , local_path , download_datasets )
607
-
608
-
609
- @octue_cli .command ()
576
+ @twined .command ()
610
577
@click .option (
611
578
"-c" ,
612
579
"--service-config" ,
0 commit comments