-
Notifications
You must be signed in to change notification settings - Fork 61
/
__init__.py
104 lines (85 loc) 路 2.61 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#
# Copyright (c) 2022, Neptune Labs Sp. z o.o.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
"""``neptune`` is a global object that you can use to start new tracked runs or re-connect to already existing ones.
It also provides some convenience functionalities like obtaining the last created run.
You may also want to check `Neptune docs page`_.
.. _Neptune docs page:
https://docs.neptune.ai/api-reference/neptune
"""
from typing import Optional
from neptune.new import types
from neptune.new.constants import ANONYMOUS, ANONYMOUS_API_TOKEN
from neptune.new.exceptions import (
NeptunePossibleLegacyUsageException,
NeptuneUninitializedException,
)
from neptune.new.internal.init import (
get_project,
init,
init_model,
init_model_version,
init_project,
init_run,
)
from neptune.new.metadata_containers import Run
from neptune.new.version import version
__version__ = str(version)
def _raise_legacy_client_expected(*args, **kwargs):
raise NeptunePossibleLegacyUsageException()
create_experiment = (
get_experiment
) = (
append_tag
) = (
append_tags
) = (
remove_tag
) = (
set_property
) = (
remove_property
) = (
send_metric
) = (
log_metric
) = (
send_text
) = (
log_text
) = (
send_image
) = (
log_image
) = send_artifact = delete_artifacts = log_artifact = stop = _raise_legacy_client_expected
def get_last_run() -> Optional[Run]:
"""Returns last created Run object.
Returns:
``Run``: object last created by neptune global object.
Examples:
>>> import neptune.new as neptune
>>> # Crate a new tracked run
... neptune.init(name='A new approach', source_files='**/*.py')
... # Oops! We didn't capture the reference to the Run object
>>> # Not a problem! We've got you covered.
... run = neptune.get_last_run()
You may also want to check `get_last_run docs page`_.
.. _get_last_run docs page:
https://docs.neptune.ai/api-reference/neptune#get_last_run
"""
last_run = Run.last_run
if last_run is None:
raise NeptuneUninitializedException()
return last_run