예제 #1
0
    def test_extract(self):
        attr = Attribute(name='test')
        assert attr.extract(value='some value') == 'some value'
        assert attr.extract(value=1) == '1'

        attr = Attribute(name='test', attr_type=int)
        assert attr.extract(value=1) == 1

        attr = Attribute(name='test', is_datetime=True)
        dt = datetime(2000, 12, 12, tzinfo=UTC)
        assert attr.extract(value=dt) == 976579200.0

        attr = Attribute(name='test', is_uuid=True)
        uid = uuid.uuid4()
        assert attr.extract(value=uid) == uid.hex
예제 #2
0
class UserGITLABEvent(Event):
    event_type = USER_GITLAB
    actor_id = 'id'
    attributes = (
        Attribute('id'),
    )
예제 #3
0
class UserRegisteredEvent(Event):
    event_type = USER_REGISTERED
    actor_id = 'id'
    attributes = (
        Attribute('id'),
    )
예제 #4
0
class JobDeletedEvent(Event):
    event_type = JOB_DELETED
    attributes = (Attribute('id'), )
예제 #5
0
class ExperimentGroupNewStatusEvent(Event):
    event_type = EXPERIMENT_GROUP_NEW_STATUS
    attributes = (
        Attribute('id'),
        Attribute('project.id'),
        Attribute('project.user.id'),
        Attribute('user.id'),
        Attribute('updated_at', is_datetime=True),
        Attribute('concurrency', is_required=False),
        Attribute('search_algorithm', is_required=False),
        Attribute('has_early_stopping', attr_type=bool, is_required=False),
        Attribute('has_description', attr_type=bool),
        Attribute('last_status'),
        Attribute('previous_status', is_required=False),
    )
예제 #6
0
class UserDeletedEvent(Event):
    event_type = USER_DELETED
    actor_id = 'actor_id'
    attributes = (Attribute('id'), Attribute('actor_id'))
예제 #7
0
class NotebookCleanedTriggeredEvent(Event):
    event_type = NOTEBOOK_CLEANED_TRIGGERED
    attributes = (Attribute('id'), )
예제 #8
0
class UserDeletedEvent(Event):
    event_type = USER_DELETED
    actor = True
    attributes = (
        Attribute('id'),
    )
예제 #9
0
class ExperimentNewMetricEvent(Event):
    event_type = EXPERIMENT_NEW_METRIC
    attributes = (Attribute('id'), Attribute('project.id'),
                  Attribute('experiment_group.id', is_required=False))
예제 #10
0
class ExperimentDeletedEvent(Event):
    event_type = EXPERIMENT_DELETED
    attributes = (Attribute('id'), )
예제 #11
0
 class DummyEvent2(Event):
     event_type = 'dummy.event'
     actor = True
     actor_id = 'some_actor_id'
     actor_name = 'some_actor_name'
     attributes = (Attribute('attr1'), )
예제 #12
0
 class DummyEvent1(Event):
     event_type = 'dummy.event'
     actor = True
     attributes = (Attribute('attr1'), )
예제 #13
0
class BuildJobDeletedEvent(Event):
    event_type = BUILD_JOB_DELETED
    attributes = (Attribute('id'), )
예제 #14
0
class ExperimentGroupViewedEvent(Event):
    event_type = EXPERIMENT_GROUP_VIEWED
    actor_id = 'actor_id'
    attributes = (
        Attribute('id'),
        Attribute('project.id'),
        Attribute('project.user.id'),
        Attribute('user.id'),
        Attribute('actor_id'),
        Attribute('updated_at', is_datetime=True),
        Attribute('concurrency', is_required=False),
        Attribute('search_algorithm', is_required=False),
        Attribute('has_early_stopping', attr_type=bool, is_required=False),
        Attribute('has_description', attr_type=bool),
        Attribute('last_status'),
    )
예제 #15
0
class ExperimentJobNewStatusEvent(Event):
    event_type = EXPERIMENT_JOB_NEW_STATUS
    attributes = (
        Attribute('id'),
    )
예제 #16
0
class UserActivatedEvent(Event):
    event_type = USER_ACTIVATED
    actor = True
    attributes = (
        Attribute('id'),
    )
예제 #17
0
class ExperimentCleanedTriggeredEvent(Event):
    event_type = EXPERIMENT_CLEANED_TRIGGERED
    attributes = (Attribute('id'), )
예제 #18
0
class NotebookDeletedEvent(Event):
    event_type = NOTEBOOK_DELETED
    attributes = (Attribute('id'), )
예제 #19
0
class ExperimentCreatedEvent(Event):
    event_type = EXPERIMENT_CREATED
    actor = True
    actor_id = 'user.id'
    actor_name = 'user.username'
    attributes = (
        Attribute('id'),
        Attribute('project.id'),
        Attribute('project.user.id'),
        Attribute('experiment_group.id', is_required=False),
        Attribute('experiment_group.user.id', is_required=False),
        Attribute('created_at', is_datetime=True),
        Attribute('has_description', attr_type=bool),
        Attribute('is_resume', attr_type=bool),
        Attribute('is_restart', attr_type=bool),
        Attribute('is_copy', attr_type=bool),
        Attribute('is_clone', attr_type=bool),
        Attribute('is_independent', attr_type=bool),
        Attribute('has_specification', attr_type=bool),
        Attribute('framework', attr_type=bool, is_required=False),
    )
예제 #20
0
class UserActivatedEvent(Event):
    event_type = USER_ACTIVATED
    actor_id = 'actor_id'
    attributes = (Attribute('id'), Attribute('actor_id'))
예제 #21
0
class ProjectSetPublicEvent(Event):
    event_type = PROJECT_SET_PUBLIC
    attributes = (
        Attribute('id'),
        Attribute('user.id'),
    )
예제 #22
0
 class DummyEvent(Event):
     event_type = 'dummy.event'
     actor_id = 'actor_id'
     attributes = (Attribute('attr1'), )
예제 #23
0
class ProjectSetPrivateEvent(Event):
    event_type = PROJECT_SET_PRIVATE
    attributes = (
        Attribute('id'),
        Attribute('user.id'),
    )
예제 #24
0
class ExperimentGroupStoppedTriggeredEvent(Event):
    event_type = EXPERIMENT_GROUP_STOPPED_TRIGGERED
    actor = True
    attributes = (
        Attribute('id'),
        Attribute('project.id'),
        Attribute('project.user.id'),
        Attribute('user.id'),
        Attribute('updated_at', is_datetime=True),
        Attribute('concurrency', is_required=False),
        Attribute('search_algorithm', is_required=False),
        Attribute('has_early_stopping', attr_type=bool, is_required=False),
        Attribute('has_description', attr_type=bool),
        Attribute('last_status'),
        Attribute('pending', attr_type=bool, is_required=False),
    )
예제 #25
0
class ProjectDeletedEvent(Event):
    event_type = PROJECT_DELETED
    attributes = (
        Attribute('id'),
        Attribute('is_public', attr_type=bool),
    )
예제 #26
0
class JobCleanedTriggeredEvent(Event):
    event_type = JOB_CLEANED_TRIGGERED
    attributes = (Attribute('id'), )
예제 #27
0
class TensorboardCleanedTriggeredEvent(Event):
    event_type = TENSORBOARD_CLEANED_TRIGGERED
    attributes = (Attribute('id'), )
예제 #28
0
class UserUpdatedEvent(Event):
    event_type = USER_UPDATED
    actor_id = 'id'
    attributes = (
        Attribute('id'),
    )
예제 #29
0
 def test_name_should_not_be_instance(self):
     with self.assertRaises(AssertionError):
         Attribute(name='instance')
예제 #30
0
class UserBITBUCKETEvent(Event):
    event_type = USER_BITBUCKET
    actor_id = 'id'
    attributes = (
        Attribute('id'),
    )
예제 #31
0
    def test_extract(self):
        attr = Attribute(name='test')
        assert attr.extract(value='some value') == 'some value'
        assert attr.extract(value=1) == '1'

        attr = Attribute(name='test', attr_type=int)
        assert attr.extract(value=1) == 1

        attr = Attribute(name='test', is_datetime=True)
        dt = datetime(2000, 12, 12, tzinfo=UTC)
        assert attr.extract(value=dt) == 976579200.0

        attr = Attribute(name='test', is_uuid=True)
        uid = uuid.uuid4()
        assert attr.extract(value=uid) == uid.hex